Installing And Using OpenVZ On Debian Wheezy (AMD64) - Page 2
2.2 Installing The Debian Wheezy Kernel From The OpenVZ Project
Add the following line to /etc/apt/sources.list:
Add the OpenVZ key to apt:
wget -O- "http://ftp.openvz.org/debian/archive.key" | apt-key add -
Update the packages database:
Install the OpenVZ kernel, vzctl, vzquota, and vzdump as follows:
apt-get install vzkernel vzctl vzquota vzdump
Next we have to make sure that the correct kernel (the OpenVZ kernel) is booted when you restart the system. In the output of the last command, you should see something like this:
Generating grub.cfg ...
This means there is also another kernel on the system (3.2.0), and the openVZ kernel (2.6.32) is not the first in the list. So to make the OpenVZ kernel the default kernel, we have two options - adjust the default kernel in GRUB (recommended) or remove the non-VZ kernel(s).
To adjust the default kernel in GRUB, open /etc/default/grub...
... and modify the GRUB_DEFAULT line (counting starts with 0; because each kernel comes also with a recovery mode, our OpenVZ kernel is the third kernel, so we need to put in 2 here):
Update GRUB afterwards:
To remove the default kernel, run...
apt-get remove linux-image-amd64 linux-image-3.2.0-4-amd64
... and update GRUB:
Now that we have made sure the correct kernel will boot, we can go on.
Next we must check that we are using UUIDs instead of device names in /etc/fstab because otherwise the system might not boot with the OpenVZ kernel. Run...
... to find out the UUIDs of your devices/partitions:
My original /etc/fstab looks as follows (as you see, the UUID of the /boot partition is already being used, but for / and swap, the device names are in use):
Modify it so that UUIDs are used for all partitions:
Create a symlink from /var/lib/vz to /vz to provide backward compatibility:
ln -s /var/lib/vz /vz
Open /etc/sysctl.conf and make sure that you have the following settings in it:
If you need to modify /etc/sysctl.conf, run
The following step is important if the IP addresses of your virtual machines are from a different subnet than the host system's IP address. If you don't do this, networking will not work in the virtual machines!
Open /etc/vz/vz.conf and set NEIGHBOUR_DEVS to all:
Finally, reboot the system:
If your system reboots without problems, then everything is fine!
and your new OpenVZ kernel should show up:
root@server1:~# uname -r