Installation and Configuration of Xen Virtualization on CentOS 6.6
Overview
Red Hat has shifted its focus from Xen to KVM, and as a result, native support for Xen is no longer available in RHEL6. However, Xen remains a viable option for virtualization, especially when considering its mature technology and stability. In this guide, we will outline the steps to install and configure Xen on CentOS 6.6 under Xen virtualization.
Hardware and Software Requirements
- Hardware: HP DL360 G6 (E5520, 16G, 2 * 146GB)
- System version: CentOS-6.6-x86_64-minimal.iso
- Software: CentOS 6.6
System Initialization
- Download the necessary packages from the following URL:
http://blog.linuxeye.com/lnmp-full.tar.gz
- Extract the contents of the package using the following command:
tar xzf lnmp-full.tar.gz
- Change into the extracted directory using the following command:
cd lnmp
- Run the installation script using the following command:
./install.sh
- Configure the system to disable the iptables service using the following command:
chkconfig iptables off
- Install the bridge-utils package using the following command:
yum -y install bridge-utils
Installation of Xen Virtualization
- Install the Xen virtualization package using the following command:
yum -y install http://au1.mirror.crc.id.au/repo/el6/x86_64/kernel-xen-release-6-7.noarch.rpm
- Install the Xen kernel using the following command:
yum -y install xen
- Create a symbolic link to the Xen kernel using the following command:
lrwxrwxrwx 1 root root 12 Dec 1 18:42 /boot/xen.gz -> xen-4.2.5.gz
- Install the kernel-xen package using the following command:
yum -y install kernel-xen
NIC Configuration
- Create a new file called
/etc/sysconfig/network-scripts/ifcfg-xenbr0
with the following contents:
DEVICE=xenbr0
TYPE=Bridge
ONBOOT=yes
DELAY=0
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.3.20
NETMASK=255.255.255.0
GATEWAY=192.168.3.1
- Create a new file called
/etc/sysconfig/network-scripts/ifcfg-eth0
with the following contents:
DEVICE=eth0
HWADDR=F4:CE:46:85:64:34
TYPE=Ethernet
UUID=c27373b9-a698-4ac8-9afe-a4dee87f5704
ONBOOT=yes
BRIDGE=xenbr0
NM_CONTROLLED=no
- Restart the network service using the following command:
service network restart
Restart and Boot into Xen
- Restart the system to boot into Xen.
- Verify that the system is running on Xen using the following command:
cat /boot/grub/grub.conf
Installation of Virtualization Management Tools
- Install the libvirt package using the following command:
yum -y install libvirt
- Start the libvirtd service using the following command:
service libvirtd start
- Install the python-virtinst package using the following command:
yum -y install python-virtinst
Installation of Guest Operating System
- Mount the CentOS 6.6 installation ISO file using the following command:
mount 192.168.3.10:81 /mnt
- Copy the necessary files to the installation directory using the following command:
cp -r /mnt/centos6.6 /data/xen/
- Create a new directory called
/data/xen/centos6.6
with the following contents:
[Images-xen]
kernel = images/pxeboot/vmlinuz
initrd = images/pxeboot/initrd.img
- Install the guest operating system using the following command:
virt-install -n vm21 -r 2048 --vcpus=2 --nographic --disk path=/data/xen/vm21.img,size=20 --location=http://192.168.3.10:81/centos6.6/ --bridge=xenbr0,model=virtio
Mirror Cloning
- Create a new directory called
/data/xen/vm22
with the following contents:
[Images-xen]
kernel = images/pxeboot/vmlinuz
initrd = images/pxeboot/initrd.img
- Clone the guest operating system using the following command:
virt-clone -o vm21 -n vm22 -f /data/xen/vm22.img
By following these steps, you should now have a fully functional Xen virtualization environment on CentOS 6.6.