This is a "copy & paste" HowTo! The easiest way to follow this tutorial is to use a command line client/SSH client (like PuTTY for Windows) and simply copy and paste the commands (except where you have to provide own information like IP addresses, hostnames, passwords,...). This helps to avoid typos.

Building A Virtual Server (VPS) With Debian 3.1 (Sarge) And OpenVZ

Version 1.2
Author: Till Brehm <t.brehm [at] howtoforge [dot] com >

In this HowTo I will describe the steps to be taken to prepare a server for OpenVZ virtual machines on Debian 3.1 (Sarge) 32Bit Linux. 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 kernal patch is licensed under the GPL license, and the user-level tools are under the QPL license.

In the first chapter I will compile the linux kernel for Debian with the OpenVZ patches. This results in an easy-to-install .deb package. This is nescessary when you need drivers that are not compiled in the stock kernel that is avilable from  You can skip the first chapter if the precompiled kernel fulfills your needs and install the kernel as described in chapter 1.2.

I want to say first 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!

Please note: if you want to use the precompiled OpenVZ kernel, you can skip the sections 1 and 1.1 and go directly to 1.2. If you want to compile your own kernel, please read the sections 1 and 1.1 before you proceed with 1.2.

1 Prepare Your Server To Host Virtual Private Servers

First we install some prerequisites for the kernel compilation.

apt-get install kernel-package libncurses5-dev fakeroot wget bzip2

1.1 Compiling The OpenVZ linux kernel

Downloading The Kernel Sources

The OpenVZ patch is currently available for the kernel 2.6.8 only. We will use the vanilla kernel from and patch and configure it for our needs. To download and unpack the sources, execute the following commads:

cd /usr/src
tar xjf linux-2.6.8.tar.bz2
cd linux-2.6.8/

Getting The OpenVZ Patch And Patch The Kernel

Now we download the OpenVZ kernel patch from and apply it to the kernel sources.

gzip -d patch-022stab078-combined.gz
patch -p1 < patch-022stab078-combined

Getting The Kernel Config For OpenVZ offers several kernel configurations from generic i686 to enterprise configurations. I select the generic i686 configuration. You may select another config depending on your hardware and processor. The configs can be downloaded from here:


Now run "make menuconfig", select "Load an alternate configuration file" and select the file "/usr/src/linux-2.6.8/kernel-2.6.8-022stab078-i686.config.ovz".

make menuconfig

If you have some special kernel config requirements, change them now. Then select Exit and then Save to save the kernel configuration.

make-kpkg clean

Now we compile the kernel.

fakeroot make-kpkg --revision=OpenVZ.2.6.8 kernel_image

If the compilation stops with an error, run

make clean

and then re-run the previous commands starting with

make menuconfig

1.2 Installing The OpenVZ Kernel

If you have skipped the first chapter, you can install the precompiled Debian kernel now.

Add the repository for the OpenVZ Tools to /etc/apt/sources.list:

echo "deb stable openvz" >> /etc/apt/sources.list
apt-get update

Install the packages:

apt-get install kernel-image-2.6.8-stable-ovz

1.3 Installing OpenVZ Tools

Install the packages:

apt-get install vzctl vzquota vzctl-template

Now you should reboot your server:

shutdown -r now

Share this page:

7 Comment(s)