Virtualization with OpenVZ – OpenVZ Kernel Install

OpenVZ is known as being the free version of Virtuozzo(created by the guys at Parallels, former SwSoft) and i have to say that it is working really nice if you know your way around shell commands as this one comes without any Control Panel to manage the Containers and resources.

There are some nice Panels out there that can be used with OpenVZ and one of the is HyperVM created by the guys from LxLabs.

Anyway, will talk right now about installing the OpenVZ kernel/package on the server using command shell.

For this to be completed you need a fresh installed server(recommend CentOS 5) and root access to the server.

First we have to install the kernel for OpenVZ:

[root@test ~]#cd /etc/yum.repos.d

[root@test yum.repos.d]#wget http://download.openvz.org/openvz.repo

[root@test yum.repos.d]#cd /

[root@test /]#yum -y install ovzkernel

After the kernel was installed we have to enable IP forwarding :

[root@test /]#vi /etc/sysctl.conf

Change the following lines to look like this:

net.ipv4.ip_forward = 1
kernel.sysrq = 1

And add this at the bottom of that file:

net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0

At last edit the grub.conf(menu.lst) file to let the server know to boot our new kernel by setting the default boot kernel:

[root@test /]#vi /boot/grub/grub.conf

Change the default value: default=0

Reboot the server:

[root@test /]#reboot or [root@test /]#shutdown -r now

If you are doing everything remotely and want to test the kernel and make sure that the server will boot up even if the kernel fails you can try the following:

[root@test /]# grub

grub> savedefault --default=0 --once

grub> quit

Run the reboot command now.

After the server is back up check to see what kernel is using:

[root@test /]#uname -r

And if everything is fine you should see the new kernel.

The next thing to do is to install the operation commands:

[root@test /]#yum -y install vzctrl vzquota vzpkg

When the Yum will finish installing the commands the only thing left to do is to try and start OpenVZ and if is working:

[root@test /]#/etc/rc.d/init.d/vz start
Starting OpenVZ: [ OK ]
Bringing up interface venet0: [ OK ]
Configuring interface venet0: [ OK ]

Share/Bookmark