OpenVZ Installation On CentOS 5

OpenVZ is the open-source branch of Virtuozzo, a commercial virtualization solution used by many providers that offer virtual servers.

In order to install OpenVZ, Follow the below steps,

First Step , we need to add the OpenVZ repository to yum

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

The repository contains a few different OpenVZ kernels

  • yum search ovzkernel

This will shows you the available kernels and then install it.

  • yum install ovzkernel
  • vi /boot/grub/menu.lst

open /boot/grub/menu.lst; the first kernel stanza should now contain the new OpenVZ kernel. So to make sure add “OpenVZ” to it and make sure the default value is set to 0 so that the first kernel (the OpenVZ kernel) is booted automatically instead of the default CentOS kernel.

It looks like,

title CentOS OpenVZ (2.6.18-53.1.19.el5.028stab053.14)
root (hd0,0)
kernel /vmlinuz-2.6.18-53.1.19.el5.028stab053.14 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-53.1.19.el5.028stab053.14.img

  • yum install vzctl vzquota

This will install some OpenVZ user tools

  • Open /etc/vz/vz.conf and set NEIGHBOUR_DEVS to all
  • SELinux needs to be disabled if you want to use OpenVZ. Open /etc/sysconfig/selinux and set the value of SELINUX to disabled:

vi /etc/sysconfig/selinux

  • reboot the server

# reboot

  • Run uname -r

OpenVZ kernel should show up:

[root@server1 ~]# uname -r
2.6.18-53.1.19.el5.028stab053.14

Openvz installation is completed.