XEN installation on CentOS 5.2

OS installation:

While installation the OS, in Anaconda you just have to choose “Virtualization”. All relevant XEN packages and the corresponding kernel will then be installed automatically.

Installing XEN manually:

yum install xen-kernel xen

Before using XEN, you have to reboot to boot the new kernel.

Verify having the right kernel using:

uname -a

Now we’re going to create our first image. On CentOS you can simply run:


The following questions you can answer as follows:

What is the name of your virtual machine? xen01
How much RAM should be allocated (in megabytes)? 256
What would you like to use as the disk (path)? /xen/xen01.img
How large would you like the disk (/xen/xen01.img) to be (in gigabytes)? 10
Would you like to enable graphics support? (yes or no) no
What is the install location?  http://mirror.centos.org/centos/5.2/os/i386

You can also install any other OS using an ISO image (CD/DVD), use virt-install –help to see a list of all available options.

Then the installation will start. You will have to create partitions and configure your network settings just like when installation a CentOS on a PC. After the installation a configuration file for xen01 will be found in /etc/xen.

Here are yet some useful commands:

  • xm list shows a list of all available vm’s
  • xm create -c /etc/xen/xen01 starts up the vm
  • xm shutdown xen01 stops your vm
  • xm destroy xen01 stops your vm immediately without shutting down the OS
  • xm console xen01 will allow you to login to the vm’s console
  • xm help shows all available options of this command

If you want to startup one or several vm’s at system bootup, you can create symlinks to the vm’s configuration file in /etc/xen/auto:

mkdir /etc/xen/auto
ln -s /etc/xen/xen01 /etc/xen/auto/xen01