Version 10 (modified by rock, 17 years ago) (diff) |
---|
Xen Installation
Installation
Install from Debian package (the latest version -> Xen-3.0.3)
- Our OS is Debian etch, we use deb package to install Xen
$ sudo aptitude install xen-linux-system-2.6.18-6-xen-686 (you can refer to our installation log in attache file) $ sync ; sudo reboot (reboot system and choose xen-enable kernel)
Install form Xen source (the latest version -> Xen-3.2.0, OpenNebula just spuuort Xen-3.1 later)
- Install requirement package
$ aptitude install mercurial iproute bridge-utils python-twisted gcc binutils make zlib1g-dev python-dev transfig bzip2 screen ssh debootstrap libcurl3-dev libncurses5-dev x-dev libsdl1.2-dev bin86 bcc python-pam patch latex-make qemu qemu-launcher qemuctl graphviz graphviz-dev lvm2 libvncserver-dev libjpeg62-dev libjpeg62 gettext python-xml gawk pciutils pciutils-dev libc6.xen
- Install Xen-3.2.0
$ wget http://bits.xensource.com/oss-xen/release/3.2.0/xen-3.2.0.tar.gz $ wget http://bits.xensource.com/oss-xen/release/3.2.0/linux-2.6.18-xen-3.2.0.tar.gz $ mkdir ~/xen $ tar zxvf xen-3.2.0.tar.gz -C ~/xen/ && tar zxvf linux-2.6.18-xen-3.2.0.tar.gz -C ~/xen/ $ cd ~/xen/xen-3.2.0 $ hg clone http://xenbits.xensource.com/linux-2.6.18-xen.hg $ make dist && make install $ depmod 2.6.18-xen $ mkinitramfs -o /boot/initrd.img-2.6.18-xen 2.6.18-xen $ update-grub
Check Xen
- Check our Xen system
$ uname -a Linux one 2.6.18-6-xen-686 #1 SMP Sun Feb 10 22:43:13 UTC 2008 i686 GNU/Linux
- Configure our Xen environment
$ vim /etc/xen/xend-config.sxp 71: network-script network-bridge 87: #network-script netwok-dummy $ xend restart $ xm list
Xen Operation
Install Guest OS (DomU)
- To create simple Guest OS, try xen-create-image which is included in xen-tools
$ man xen-create-image
- Debian package: xen-tools
- Install Guest OS
$ sudo mkdir /home/xen_img $ sudo dd if=/dev/zero of=/home/xen_img/etch.img bs=1G count=5 $ sudo dd if=/dev/zero of=/home/xen_img/etch.swap bs=514MB count=1 $ sudo /home/xen_img/mkfs.ext3 etch.img $ sudo /home/xen_img/mkswap etch.swap $ sudo mount -o loop etch.img /mnt $ sudo debootstrap --arch i386 etch /mnt/ http://free.nchc.org.tw/debian
- Config Guest OS
$ sudo vim /etc/fstab /etc/fstab /dev/hda1 / ext3 defaults 0 1 /dev/hda2 swap swap defaults 0 0 proc /proc proc defaults 0 0 $ sudo vim /etc/hostname etch $ sudo vim /etc/hosts $ sudo vim /etc/network/interfaces $ sudo cp /etc/apt/sources.list /mnt/etc/apt/ $ sudo cp -r /lib/modules/2.6.18-6-xen-686/ /mnt/lib/modules/ $ sudo chroot /mnt $ passwd root $ adduser rock $ sudo umount /mnt
- Edit Guest OS configuration
$ sudo vim /home/xen_img/etch.cfg # Kernel image kernel = "/boot/vmlinuz-2.6.18-6-xen-686" ramdisk = "/boot/inird.img-2.6.18-6-xen-686" # Domain name name = "etch" # 0achine information vcpus = 4 memory = 256 disk = ['file:/home/xen_img/etch.img,hda1,w','file:/home/xen_img/etch.swap,hda2,w'] vif = ['mac=00:00:00:00:00:01,bridge=xenbr1']
- Guest OS problem
$ mount /home/xen_img/etch.img /mnt $ chroot /mnt Guest booting Error: 4gb seg fixup, process init (pid 1), cs:ip 73:b7e192fc $ aptitinstall libc6-xen locale problem: $ aptitinstall install locales $ dpkg-reconfigure -a locale $ tzxonfig