http:// www.jms1.net / xen / install-xen.shtml

Xen - Installing Xen

The procedure on this page will take a newly installed CentOS 4.2 machine and convert it so that it runs as a xen0 domain (a Xen client, running as client #0 with rights to directly access the hardware and administer the Xen hypervisor.)


Install pre-requisite packages

Before we can install Xen, there are several packages which need to be installed first.

# yum install bridge-utils gcc gcc-c++ libtool automake autoconf
... This will want to install several other packages as well. Say YES.

In particular, the lksctp-tools package needs to be upgraded to work with the newer kernel that Xen will install, and the CentOS repository does not contain a new enough version. You can download the newest source RPM from SourceForge and use that to build binary RPM files.

# wget http://internap.dl.sourceforge.net/sourceforge/lksctp/lksctp-tools-1.0.4-1.src.rpm
# mkdir -p /usr/src/redhat
# rpm -i lksctp-tools-1.0.4-1.src.rpm
# cd /usr/src/redhat/SPECS
# rpmbuild -ba lksctp-tools.spec
...
# cd ../RPMS/i386
# rpm -Fvh lksctp-*


Download and install the Xen packages

This page is the xensource.com "home page" for Xen. It contains links to download Xen itself, as well as the Xen User Manual. I cannot recommend strongly enough that you download a copy of the user manual.

The downloads available include a set of RPM packages for RedHat Enterprise 4.1. Since CentOS (my distro of choice for the host OS) is a "clone" of RedHat Enterprise, I will use BitTorrent (on another machine) to download the tarball containing the RPM packages, and then copy the tarball to root's home directory on the new machine.

The directions for installing the RPMs talk about "upgrading" the existing glibc packages (along with some others.) The problem is that the versions included with CentOS 4.2 are newer than the versions included with the RPM tarball. I am not going to forcibly downgrade packages like this, so I will only be installing the Xen RPM files.

# tar xvf xen-3.0-x86_32-rhel4.1.bin.tar
...
# cd xen-3.0-x86_32-rhel4.1.bin
# rpm -Uvh xen-*
Preparing... ########################################### [100%]
1:xen-kernel ########################################### [ 50%]
2:xen ########################################### [100%]


Set up Xen to boot

The next step is to add an entry to your grub.conf file which will make grub load Xen instead of loading the normal Linux kernel.

Note that unless your grub.conf explicitly declares a default entry, the default will be the first entry listed in the file. You will probably want Xen's block to be listed first once you know it works, but in the meantime you may want to put Xen at the end of the file and leave your existing CentOS boot block in place as the default.

# nano /boot/grub/grub.conf
Find the first line which starts with "title". Before this line, or at the end of the file, add the following block:

title Xen 3.0 (Linux 2.6.12)
        root (hd0,0)
        kernel /xen-3.0.gz dom0_mem=131072
        module /vmlinuz-2.6-xen ro root=/dev/disks/0root console=tty0
        module /initrd-2.6-xen.img

The two "root" items above (shown in red) should be replaced with the current values from an existing block in the file.

The last step before rebooting, since we did not install the xen-specific glibc packages, is to rename /lib/tls to /lib/tls.disabled. The libraries in this directory interfere with how Xen works- and while Xen is capable of working around the change, it slows the entire system down. Renaming the directory prevents these libraries from being used.

# mv /lib/tls /lib/tls.disabled
# ldconfig

The last step is to reboot and let Xen run.

# shutdown -r now