Installing And Using OpenVZ On Debian Wheezy (AMD64)

Version 1.0
Author: Falko Timme
Follow me on Twitter

In this HowTo I will describe how to prepare a Debian Wheezy server for OpenVZ. With OpenVZ you can create multiple Virtual Private Servers (VPS) on the same hardware, similar to Xen and the Linux Vserver project. OpenVZ is the open-source branch of Virtuozzo, a commercial virtualization solution used by many providers that offer virtual servers. The OpenVZ kernel patch is licensed under the GPL license, and the user-level tools are under the QPL license.

This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!


1 Preliminary Note

I'm using an x86_64 (amd64) system here. If you are on an i386 system, a few commands will be slightly different.


2 Installing OpenVZ

For Debian Wheezy, there is no OpenVZ kernel in the official repositories. Therefore we have three options:

  1. Installing from the official RPM packages from the OpenVZ project (see Install kernel from RPM on Debian 6.0) - with ploop support! (recommended)
  2. Installing the Debian Wheezy kernel from the OpenVZ project and the other packages from the official Debian Wheezy repositories (see Installation on Debian) - kernel with ploop support, but the vzctl package from Debian does not support it.
  3. Installing from Proxmox packages (see Install Proxmox VE on Debian Wheezy) - no ploop support in kernel.


2.1 Installing From The Official RPM Packages From The OpenVZ Project

Download the latest vzkernel, vzctl, ploop and vzquota RPM packages from and, e.g. as follows::

cd /tmp

Install the following packages...

apt-get install fakeroot alien libcgroup1

... and convert the RPM packages to DEB packages:

fakeroot alien --to-deb --scripts --keep-version vz*.rpm ploop*.rpm

Install the DEB packages as follows:

dpkg -i vz*.deb ploop*.deb

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:

Setting up vzkernel (2.6.32-042stab076.8) ...
update-initramfs: Generating /boot/initrd.img-2.6.32-042stab076.8
WARNING: could not open /lib/modules/2.6.32-042stab076.8/modules.builtin: No such file or directory
WARNING: could not open /var/tmp/mkinitramfs_baPCFp/lib/modules/2.6.32-042stab076.8/modules.builtin: No such file or directory
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-4-amd64
Found initrd image: /boot/initrd.img-3.2.0-4-amd64
Found linux image: /boot/vmlinuz-2.6.32-042stab076.8
Found initrd image: /boot/initrd.img-2.6.32-042stab076.8

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...

vi /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:

[email protected]:/tmp# blkid
/dev/mapper/server1-swap_1: UUID="c465cb44-1bf9-4fbe-bb31-17139fd43004" TYPE="swap"
/dev/sda5: UUID="WRK6Xm-fg52-T836-sp4k-6uxm-trHH-FiRdBx" TYPE="LVM2_member"
/dev/sda1: UUID="46d1bd79-d761-4b23-80b8-ad20cb18e049" TYPE="ext2"
/dev/mapper/server1-root: UUID="d5ac6d76-0b69-46da-b0c1-a4376f2f0e4e" TYPE="ext4"
[email protected]:/tmp#

Open /etc/fstab:

vi /etc/fstab

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):

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/server1-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=46d1bd79-d761-4b23-80b8-ad20cb18e049 /boot           ext2    defaults        0       2
/dev/mapper/server1-swap_1 none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

Modify it so that UUIDs are used for all partitions:

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
#/dev/mapper/server1-root /               ext4    errors=remount-ro 0       1
UUID=d5ac6d76-0b69-46da-b0c1-a4376f2f0e4e /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=46d1bd79-d761-4b23-80b8-ad20cb18e049 /boot           ext2    defaults        0       2
#/dev/mapper/server1-swap_1 none            swap    sw              0       0
UUID=c465cb44-1bf9-4fbe-bb31-17139fd43004 none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

Make sure OpenVZ starts automatically at boot time:

update-rc.d vz defaults
update-rc.d vzeventd defaults

Next we need to link a few libraries:

ln -s /usr/lib64/ /usr/lib
ln -s /usr/lib64/ /usr/lib

If you want to use ploop containers, do this:

apt-get install parted

Also, open /etc/init.d/vz...

vi /etc/init.d/vz

... and add the line mkdir $VARLOCK/ploop to make sure that the directory /var/lock/ploop is recreated after a reboot:

#  Copyright (C) 2000-2009, Parallels, Inc. All rights reserved.
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  GNU General Public License for more details.
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
# OpenVZ startup script, used for redhat and debian related distributions.

# chkconfig: 2345 96 20
# description: OpenVZ startup script.

# Provides: vz
# Required-start: $network $remote_fs $syslog
# Required-stop:  $network $remote_fs $syslog
# Should-Start:  sshd vzeventd
# Should-Stop:  sshd vzeventd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenVZ startup script
# Description: OpenVZ startup script.

# This line is needed to cheat /etc/init.d/rc who expects action word

. /usr/libexec/vzctl/scripts/initd-functions
mkdir $VARLOCK/ploop

Create a symlink from /vz to/var/lib/vz to provide backward compatibility:

ln -s /vz /var/lib/vz

Open /etc/sysctl.conf and make sure that you have the following settings in it:

vi /etc/sysctl.conf

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

If you need to modify /etc/sysctl.conf, run

sysctl -p


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:

vi /etc/vz/vz.conf

# Controls which interfaces to send ARP requests and modify APR tables on.

Install vzdump:

apt-get install vzdump

Finally, reboot the system:


If your system reboots without problems, then everything is fine!


uname -r

and your new OpenVZ kernel should show up:

[email protected]:~# uname -r
[email protected]:~#

Falko Timme

About Falko Timme

Falko Timme is an experienced Linux administrator and founder of Timme Hosting, a leading nginx business hosting company in Germany. He is one of the most active authors on HowtoForge since 2005 and one of the core developers of ISPConfig since 2000. He has also contributed to the O'Reilly book "Linux System Administration".

Share this page:

Suggested articles

5 Comment(s)

Add comment









By: jokajinx

if you get this ERROR when you run this

wget -O - | sh

Setting up ruby-sqlite3 (1.3.6-2) ...
Setting up ruby1.8-dev ( ...
Setting up rubygems (1.8.24-1) ...
Setting up unzip (6.0-8) ...
Setting up zip (3.0-6) ...
Setting up libsqlite3-ruby (1.3.6-2) ...
Setting up g++-4.7 (4.7.2-5) ...
Setting up g++ (4:4.7.2-1) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up build-essential (11.5) ...
Setting up libstdc++6-4.7-dev (4.7.2-5) ...
Checking presence of the command: ruby
Fatal error: Panel requires Ruby 1.8 (Ruby 1.9 is not supported).


When installer stops do next:

2. ruby -v (output will be probably ruby1.9.1...)
1. apt-get install ruby-switch
3. ruby-switch --list (output - all installed ruby versions -> ruby1.8 & ruby1.9.1)
4. ruby-switch --set ruby1.8
5. ruby -v (output -> ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux])
6. run installer again

By: cascao

i'm unable to compleat the me..

my erro is : 

vzctl: error while loading shared libraries: cannot open shared object file: No such file or directory

...i did everyting on this tutorial...what's wrong?

By: till

Try this:

ln -s /usr/lib64/ /usr/lib 

By: Alex

Is this correct procedure, if I have existing working IspConf setup , and have been given second IP address form Hetzner and want to run that as Vserver on exisiting server ?