Install Xen 4.6 on CentOS 6.8

I have multiple Xen hosts, and I figured that I should share the setup procedure that I use to make my Virtualization Hosts, so here it goes.

First thing to do is make sure that your CPU supports hardware virtualization, otherwise you will only be able to create paravirtualized virtual machines.

Host OS Installation:

You should download the latest minimal ISO of CentOS 6.8 and install it on your chosen host, keep in mind during installation to make a 500mb boot partition, you will want this later because usually your Xen host will have 4 different kernels available. (The Xen main kernel, as well as it’s previous verions, and the normal Linux kernel and its previous version.) Configure your networking so that you can access the internet, don’t spend too much time on this because you will be changing it all around later.

Installing Xen:

Without the correct repositories your host will have no idea where to get Xen from use the following command to install the Xen Repos:

yum install centos-release-xen

Once you have your repositories setup you can use the following command to install Xen and Libvirt:

yum install xen libvirt-daemon libvirt virt-install

Configure Grub:

You will need to configure Grub to make it boot the Xen kernel so edit “/boot/grub/grub.conf” with the newer versions of CentOS and Xen, you may not even have to modify this file. If you want to take CPUs and RAM away from the host you want it to look something like this: (the host will only be able to see 1cpu and 1gb of RAM, leaving the rest totally for virtual machines)

Bridging:

The next step is to configure network bridges so that your virtual machines can access the host’s network. The files described in this section should all be created in: “/etc/sysconfig/network-scripts/” so you may just want to “cd” there now.

Finally if you just make a bridge using either of the above bridge configurations, you can make a “virtual” network where the VMs and the host can communicate but it wont be accessible from outside the host.

67 Comments

If you don’t need the Xen host to have Internet access, sometimes its a good idea to not assign an IP to the bridge interface, this will protect your host because no one would be able to access the host itself on that bridge.