Installing Xen3
From openSUSE
The instructions for installing Xen have changed considerably since this article was written. The latest procedures for installing and using Xen are still being documented, but you can view the following topics in their current state:
- An Introduction to Virtualization
- How to Install a Xen VM Server
- How to Add a VM
- How to Install a VM's OS from CD
- How to Install a VM's OS from ISO
- How to Install a VM's OS from Installation Source
- How to Install a VM's OS from Disk Image
- How to Create an OS Disk Image for a VM
- How to Manage VMs
First you might want to download the newest Xen3 packages, because Xen is still in a high state of flux. The latest packages of Xen for SLES 10 can be found at xen technical preview. Additional information and install guide are available there also.
After downloading and extracting the rpms, you can install the packages:
rpm -Uvh *.rpm
Or just install the document(s):
rpm -Uvh xen-doc*
because you are going to read it before installation. You might even want to print it for reference during the install and configuration. ( There are three flavors but they all taste the same. Choose the flavor you want from /usr/share/doc/packages/xen/ and have fun! )
After reading it, and possibly the references it suggests you read, continue with the install.
Xen conflicts in some cases with the powersave daemon. So it is better to deactivate it:
/etc/init.d/powersaved stop insserv -r powersaved
Recent kernels will automatically update your grub boot configuration when they are installed. If you are using an older kernel, or want to double-check the boot configuration, edit /boot/grub/menu.lst and make sure it looks like the following example:
(Make sure that the "kernel" line does not point to a link that again points to a link!)
color white/blue black/light-gray default 0 timeout 4 title Xen Master root (hd0,1) kernel /boot/xen-3.0.gz dom0_mem=256M module /boot/vmlinuz-xen root=/dev/sda2 module /boot/initrd-xen title SUSE Linux 10.0 root (hd0,1) kernel /boot/vmlinuz root=/dev/sda2 resume=/dev/sda1 initrd /boot/initrd
Next you can activate the Xen daemon:
/etc/init.d/xend start insserv –d xend
Finally you have to reboot your system:
reboot
First after the reboot you have to create a filesystem which will be the root filesystem for your domU. If you have lvm installed and a volume group created you can create this filesystem as follow:
This example creates a volume named root with a size of 8 GB in the volume group xenvg:
lvcreate -L 8g -n root xenvg
Then you can build a reiser filesystem on this volume and mount it:
mkfs -t reiserfs /dev/xenvg/root mkdir /var/tmp/dirinstall mount -t reiserfs /dev/xenvg/root /var/tmp/dirinstall
Now you can fill up this filesystem with:
yast dirinstall
or
yast2 dirinstall
This starts the YAST module called "dirinstall". Select all the software you'd like to install. Alternatively you can select another target directory eg. /mnt if you mounted the filesystem there. Then go to "Next". The packages will be installed now. Finally you can exit YAST again.
Then you have to make some other stuff:
cd /var/tmp/dirinstall cp /boot/*xen* ./boot cp -ax /lib/modules/`uname -r` /var/tmp/dirinstall/lib/modules/ echo "/dev/hda1 / reiserfs defaults 1 1" > ./etc/fstab rm -f ./etc/mtab sed -ie "s/^[2-6]:/#\\0/" ./etc/inittab cp /etc/passwd /etc/shadow ./etc ###optional cp /etc/ssh/sshd_config ./etc/ssh/sshd_config ###optional cp /var/adm/YaST/ProdDB/prod_* ./var/adm/YaST/ProdDB cd / umount /var/tmp/dirinstall
Your domU is now created. Next you have to build a domU configuration. The following example shows the configuration file /etc/xen/inhouse for the domU "inhouse":
# -*- mode: python; -*- # configuration name: name = "inhouse" # usable ram: memory = 2048 # kernel und initrd: kernel = "/boot/vmlinuz-xen" ramdisk = "/boot/initrd-xen" # boot device: root = "/dev/hda1" # boot to run level: extra = "3" # network interface: vif = [ 'mac=aa:cc:00:00:00:01, bridge=xenbr0' ] dhcp = "dhcp" hostname = name # storage devices: disk = [ 'phy:xenvg/root,hda1,w' ]
With opensuse you must give a mac address for your domU interface(s). If you do not do so, your network interface for the domU will change with each boot of domU. This is caused by the udev system.
Now you can boot this domU:
xm create -c /etc/xen/inhouse
More informations about managing domUs shows you the command:
xm help --long
Console Troubleshouting
Hints by Christian Wittmer from Scorpio IT:
This info is for xen >= 3.0.4
You can connect to DomU console after creating it(xm create domU -c) but then it seems to be that the console hangs. LOGIN prompt doesn't comes up. After disconnecting you can't connect again.
And wondering why you can ssh to domU and everthing is fine.
console interface changed from tty1 to xvc0
You have to make some other stuff:
cd /var/tmp/dirinstall cp /boot/*xen* ./boot cp -ax /lib/modules/`uname -r` /var/tmp/dirinstall/lib/modules/ echo "/dev/hda1 / reiserfs defaults 1 1" > ./etc/fstab rm -f ./etc/mtab sed -ie "s/^[2-6]:/#\\0/" ./etc/inittab sed -ie "s/\(^1:.*\)tty1/\1xvc0/" ./etc/inittab echo "xvc0" >> ./etc/securetty cp /etc/passwd /etc/shadow ./etc ###optional cp /etc/ssh/sshd_config ./etc/ssh/sshd_config ###optional cp /var/adm/YaST/ProdDB/prod_* ./var/adm/YaST/ProdDB cd / umount /var/tmp/dirinstall
Next you have to modify your domU configuration:
extra="console=xvc0"
And everything will be fine again. :)
Network Troubleshooting
Hints by Kurt Garloff from SuSE:
To make networking of your Dom0 work with SuSE you have to set up your network as
follows:
- choose the 'classic' way of setting up network (no 'NetworkManager' as offered by Yast)
- put STARTMODE of ifplugd to 'onboot' (defaults to 'on connect')
- turn off SuSEfirewall2 or configure it properly
- enable ip_forward (either by using Yast or sysctl.conf)"
After a reboot, brctl should produce something like this:
xenmaster:~ # brctl show
bridge name bridge id STP enabled interfaces
xenbr0 8000.feffffffffff no vif0.0
peth0
If xenbr0 is not showing connected interfaces, you DomU network will fail. Thanks a lot to Kurt Garloff and his effort of providing Xen RPM's!
How to configure SuSEfirewall2 to allow xenbr0 traffic
(based on SuSE 10.1)
Symptom: You have just booted the Xen-kernel and no traffic escapes dom0. This is because the firewall discards the packages.
Solution: Enable the xenbr0 forwarding:
- Open the file /etc/sysconfig/SuSEfirewall2 in your favorite editor.
- In step 33 change FW_FORWARD_ALWAYS_INOUT_DEV="" to FW_FORWARD_ALWAYS_INOUT_DEV="xenbr0".
- Restart the firewall: /etc/init.d/SuSEfirewall2_setup restart
You should now be able to ping other hosts.
Categories: HOWTOs | Xen

