CentOS Linux Install OpenVZ Virtualization Software

by on August 5, 2006 · 2 comments· LAST UPDATED February 20, 2011

in , ,

How do I install OpenVZ Virtualization container software under Red Hat Enterprise Linux or CentOS Linux 5.x server?

OpenVZ can be installed using yum command itself. All you have to do is setup correct repo.

Step # 1: Setup Yum Repo

Type the following commands. cd to /etc/yum.repos.d
# cd /etc/yum.repos.d
Download repo file:
# wget http://download.openvz.org/openvz.repo
Finally, import GPG key:
# rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ

Step # 2: Update Kernel Configuration

Type the following command to install OpenVZ Linux kernel to install 64 bit smp kernel (up to 64 GB of RAM support):
# yum install ovzkernel
Sample Outputs:

Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * addons: centose.centos.org
 * updates: centosh3.centos.org
 * extras: centose.centos.org
 * rpmforge: apt.sw.be
 * base: centose.centos.org
 * openvz-kernel-rhel5: mirrors.nullroute.me
 * openvz-utils: mirrors.nullroute.me
396 packages excluded due to repository priority protections
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package ovzkernel.i686 0:2.6.18-128.1.1.el5.028stab062.3 set to be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================
 Package                        Arch                      Version                                              Repository                                Size
==============================================================================================================================================================
Installing:
 ovzkernel                      i686                      2.6.18-128.1.1.el5.028stab062.3                      openvz-kernel-rhel5                       19 M
Transaction Summary
==============================================================================================================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 19 M
Is this ok [y/N]: y
Downloading Packages:
ovzkernel-2.6.18-128.1.1.el5.028stab062.3.i686.rpm                                                                                     |  19 MB     00:16
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : ovzkernel                                         [1/1]
Installed: ovzkernel.i686 0:2.6.18-128.1.1.el5.028stab062.3
Complete!

Alternatively, type the following command to install SMP + PAE support + 4/4GB split (up to 64 GB of RAM support) kernel:
# yum install ovzkernel-ent
You can install the following kernels:

  1. ovzkernel : Virtuozzo Linux kernel (the core of the Linux operating system)
  2. ovzkernel-PAE : The Linux kernel compiled for PAE capable machines.
  3. ovzkernel-PAE-devel : Development package for building kernel modules to match the PAE kernel.
  4. ovzkernel-devel : Development package for building kernel modules to match the kernel.
  5. ovzkernel-ent : The Linux kernel compiled for huge mem capable machines.
  6. ovzkernel-ent-devel : Development package for building kernel modules to match the ent kernel.
  7. ovzkernel-xen: The Linux kernel compiled for Xen VM operations
  8. ovzkernel-xen-devel : Development package for building kernel modules to match the kernel.

Update /etc/sysctl.conf

The OpenVZ kernel is installed and updated your GRUB configuration i.e. after a reboot, the OpenVZ kernel starts automatically. However, you need to make some changes to kernel config. Edit /etc/sysctl.conf:
# vi /etc/sysctl.conf
Setup parameters as follows:

# Enable packet forwarding enabled
net.ipv4.ip_forward = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
# Disable proxy arp
net.ipv4.conf.default.proxy_arp = 0
# Enables source route verification
net.ipv4.conf.all.rp_filter = 1
# Enables the magic-sysrq key
kernel.sysrq = 1
# We do not want all our interfaces to send redirects
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0

Save and close the file.

Disable SELinux

You must disable SELinux by editing /etc/sysconfig/selinux:
# vi /etc/sysconfig/selinux
Place the following directive:

SELINUX=disabled

Save and close the file.

Installing The VZ Utilities

Type the following command:
# yum install vzctl vzquota
Sample Outputs:

Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * addons: centosj-msync-dvd.centos.org
 * updates: centosh3.centos.org
 * extras: centose.centos.org
 * rpmforge: apt.sw.be
 * base: centosj3.centos.org
 * openvz-kernel-rhel5: openvz.mirrors.skynet.be
 * openvz-utils: openvz.mirrors.skynet.be
396 packages excluded due to repository priority protections
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package vzquota.i386 0:3.0.12-1 set to be updated
---> Package vzctl.i386 0:3.0.23-1 set to be updated
--> Processing Dependency: vzctl-lib = 3.0.23-1 for package: vzctl
--> Processing Dependency: libvzctl-0.0.2.so for package: vzctl
--> Running transaction check
---> Package vzctl-lib.i386 0:3.0.23-1 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================
 Package                               Arch                             Version                                Repository                                Size
==============================================================================================================================================================
Installing:
 vzctl                                 i386                             3.0.23-1                               openvz-utils                             143 k
 vzquota                               i386                             3.0.12-1                               openvz-utils                              82 k
Installing for dependencies:
 vzctl-lib                             i386                             3.0.23-1                               openvz-utils                             175 k
Transaction Summary
==============================================================================================================================================================
Install      3 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 400 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): vzquota-3.0.12-1.i386.rpm                                                                                                       |  82 kB     00:00
(2/3): vzctl-3.0.23-1.i386.rpm                                                                                                         | 143 kB     00:00
(3/3): vzctl-lib-3.0.23-1.i386.rpm                                                                                                     | 175 kB     00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                          40 kB/s | 400 kB     00:09
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : vzctl-lib                                         [1/3]
  Installing     : vzquota                                           [2/3]
  Installing     : vzctl                                             [3/3]
Installed: vzctl.i386 0:3.0.23-1 vzquota.i386 0:3.0.12-1
Dependency Installed: vzctl-lib.i386 0:3.0.23-1
Complete!

Reboot The Server

Finally, reboot your box and boot into new OpenVZ kernel:
# reboot

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 2 comments… read them below or add one }

1 Arjun August 16, 2009 at 8:38 am

Thanks for the post.
I am having problem configuring openvz kernel on Ubuntu, as ovzkernel is not avail in the repos. Any help?

Reply

2 Don Hawkins June 7, 2013 at 11:05 pm

yum install vzkernel

Reply

Leave a Comment

Tagged as: , , , , , , ,

Previous Faq:

Next Faq: