Installing Xen3

(Xen3 Kurulumu sayfasından yönlendirildi)
Şuraya atla: kullan, ara

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:


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 currently 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

Next you have to build a valid grub boot configuration. You should edit the /boot/grub/menu.lst file 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

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:

  1. choose the 'classic' way of setting up network (no 'NetworkManager' as offered by Yast)
  2. put STARTMODE of ifplugd to 'onboot' (defaults to 'on connect')
  3. turn off SuSEfirewall2 or configure it properly
  4. 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!