Installation of Xen on Centos6.

Redhat doesn’t ship Xen hyper-visor or Dom0 compatible kernal with RHEL6. Centos follows it and we have to compile and install the Xen (Dom0)kernel and hyper-visor separately.Still Centos6 can be used as guest virtual machine without any modification to the kernel.

In Summary by default Centos6 does:

* Centos6 runs as Xen PV (paravirtual) domU using the pvops framework in the default kernel.
* Centos6 runs as Xen HVM (fully virtualized) guest.

And we need to do:

* Install and configure supporting tools.
* Install and configure Xen Dom0 Kernel and hyper-visor.

The entire process of compiling and configuring the kernel is a tedious and we can bypass the process by configuring additional yum repositories.Thanks to http://www.gitco.de/linux/x86_64/centos/6/ repository. It contains xen dom0 capable kernel.But please note that the output kernel is not based on the Centos kernel but based on kernel.org so there might be a chance of some drivers missing even though I have not faced that issue.

So the steps for installing the Xen on Centos6 follows:

1. Copy the repository files from the site

cd /etc/yum.repos.d/; wget http://www.gitco.de/linux/x86_64/centos/6/gitco-centos6-x86_64.repo

2. This repository will get enabled by default.You need to import the repository keys by

rpm --import http://www.gitco.de/linux/x86_64/centos/6/GITCO-RPM-KEY

3. After that you can update the yum with

yum update and follow the instructions of installing dependent rpms.

4. Install xen and xen kernel with the command

yum search xen
you will get multiple xen packages. Install all of them.
After installing I got the below list:
rpm -qa | grep xen
[root@u16038171 yum.repos.d]# rpm -qa | grep xen
xen-hypervisor-4.0.1-6.1.el6.x86_64
xen-runtime-4.0.1-6.1.el6.x86_64
xen-doc-4.0.1-6.1.el6.x86_64
kernel-2.6.32.26-174.1.xendom0.el6.x86_64
xen-licenses-4.0.1-6.1.el6.x86_64
xen-devel-4.0.1-6.1.el6.x86_64
xen-debuginfo-4.0.1-6.1.el6.x86_64
kernel-firmware-2.6.32.26-174.1.xendom0.el6.x86_64
xen-libs-4.0.1-6.1.el6.x86_64
xen-4.0.1-6.1.el6.x86_64

5. Edit the /etc/grub.conf and make sure that default kernel is xen enabled kernel
The relevant entries from my grub.conf is below:

default=0
timeout=5
title CentOS (2.6.32.26-174.1.xendom0.el6.x86_64)
root (hd0,0)
kernel /boot/xen.gz
module /boot/vmlinuz-2.6.32.26-174.1.xendom0.el6.x86_64 ro root=/dev/md1 console=tty0 console=ttyS0,57600 crashkernel=auto SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=us
module /boot/initramfs-2.6.32.26-174.1.xendom0.el6.x86_64.img

6. Disable SELINUX. Below from my
Selinux gives problem to xen operations. You need to disable SELINUX with at /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

7. Reboot the machine which boots with the xen kernel
You may verify the xen kernel with the following command.

# uname -r

Similar should be the output. Notice the xendom0 in the kernel.

2.6.32.26-174.1.xendom0.el6.x86_64

8. Verify Dom0 with the command

xm info
I got the following output
host : u16038171.onlinehome-server.com
release : 2.6.32.26-174.1.xendom0.el6.x86_64
version : #1 SMP Fri Nov 26 19:21:54 CET 2010
machine : x86_64
nr_cpus : 2
nr_nodes : 1
cores_per_socket : 2
threads_per_core : 1
cpu_mhz : 2400
hw_caps : 178bf3ff:ebd3fbff:00000000:00000010:00002001:00000000:0000001f:00000000
virt_caps : hvm
total_memory : 2014
free_memory : 4
node_to_cpu : node0:0-1
node_to_memory : node0:4
node_to_dma32_mem : node0:4
max_node_id : 0
xen_major : 4
xen_minor : 0
xen_extra : .1
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
xen_commandline :
cc_compiler : gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)
cc_compile_by : rpmbuild
cc_compile_domain : gitco.tld
cc_compile_date : Fri Nov 26 21:21:52 CET 2010
xend_config_format : 4

Also with ‘xm list’ should list the dom0 host as below:

Name ID Mem VCPUs State Time(s)
Domain-0 0 1217 2 r----- 1036.9

At this point we can have our first guest system either install or from the image of an existing xen system.

References:
http://wiki.xen.org/wiki/RHEL6Xen4Tutorial

Leave a Reply