Installing XEN on CentOS 5.x

centosThis is a very simple installation of XEN visualization that I will be using in future posts as a reference.

# yum groupinstall Virtualization

Edit grub.conf to reflect the correct default Kernel

# vi /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=1
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-92.1.10.el5xen)
        root (hd0,0)
        kernel /xen.gz-3.3.0
        module /vmlinuz-2.6.18-92.1.10.el5xen ro root=/dev/VolGroup00/LogVol00
        module /initrd-2.6.18-92.1.10.el5xen.img
title CentOS (2.6.18-92.1.10.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.1.10.el5 ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-92.1.10.el5.img
title CentOS (2.6.18-92.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-92.el5.img

Reboot the machine for new XEN kernel to take effect

# reboot

After the reboot check the Kernel to reflect the change

# uname -r

 2.6.18-53.1.21.el5xen


Install a CentOS 32 bit Virtual Machine using virt-install and your local YUM repository

# virt-install -p --location=http://server1.example.co.za/centos/5/os/i386 --noautoconsole \
 --name=machine --ram=284 --file=/path/to/machine.img --file-size=5 --nographics -b xenbr0

Some useful commands

# xm list
# xm create vmmachine
# xm console vmmachine