Running Xen and OpenVZ in the same host

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search

I was able to get Xen and OpenVZ running on the same host with the same kernel in CentOS 5.2 64-bit. This is most likely be possible on other OS as well. I thought other people would also be interested in knowing how to do this. So here goes.

If you already have your OS installed skip Steps 1 to 7

1. Install the OS (Centos) via DVD/Internet/Kickstart etc. 2. Update your system

 yum install yum-fastestmirror   <=== This is installed by default if you use CentOS5.2 native install. 
 yum update -y

3. Set your Local timezone properly.

rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/{Your Zone here} /etc/localtime
yum install ntp -y

touch  /etc/cron.daily/updatetime
echo "/usr/sbin/ntpdate -u {Your NTP Server here}" > /etc/cron.daily/updatetime

/usr/sbin/ntpdate -u {Your NTP Server here}

4. Install OpenVZ Repo

cd /etc/yum.repos.d
wget http://download.openvz.org/openvz.repo
rpm --import  http://download.openvz.org/RPM-GPG-Key-OpenVZ

5. Download the Latest OpenVZ-XEN Kernel and install (DO NOT update)

wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab053.14/ovzkernel-xen-2.6.18-53.1.19.el5.028stab053.14.x86_64.rpm
rpm -ivh ovzkernel-xen-2.6.18-53.1.19.el5.028stab053.14.x86_64.rpm

6. Reboot the server/workstation after making sure the DEFAULT kernel is this one.

7. Install OpenVz tools and x86_64 templates

yum install vzctl vzquota -y 

cd /tmp
wget http://dag.wieers.com/rpm/packages/python-elementtree/python-elementtree-1.2.6-7.el4.rf.x86_64.rpm
rpm -ivh python-elementtree-1.2.6-7.el4.rf.x86_64.rpm
rm python-elementtree-1.2.6-7.el4.rf.x86_64.rpm

yum install vzpkg vzyum vzrpm43-python vzrpm44-python vzctl-lib -y 

cd /tmp
wget http://linux.carreira.com.pt/ovzutils/setx86_64-0.3.tar.gz
tar -zxvf setx86_64-0.3.tar.gz
sh setx86_64
vzpkgls

8.install the Xen tools

yum install xen.x86_64

9. Now you will be able to create XEN as well as OpenVZ guests on your system

10. To list the Xen instances running use "xen list" and to list OpenVZ containers use "vzlist"

    • you should be able to simply cut and paste these commands in CentOS. **

NOTEs: Xen tools will not let you create a Xen Guest if your available RAM is low. But OpenVZ you can pretty much create anything as long as you know the proper resource allocations.