OpenVZ – Open Source VPS Software

OpenVZ is an Operating System-level server virtualization solution, built on Linux. OpenVZ creates isolated, secure virtual environments VEs (otherwise known as virtual private servers, or VPS) on a single physical server enabling better server utilization and ensuring that applications do not conflict. Each VE performs and executes exactly like a stand-alone server; VEs can be rebooted independently and have root access, users, IP addresses, memory, processes, files, applications, system libraries and configuration files.
Using premier VPS technology, several isolated VPS systems are installed on a single physical server. Users share systems resources, such as the CPU and memory, but unlike shared hosting the file system is fully partitioned so they are not affected by other activities on the server. This means that up-time is more consistent, while root access to the server provides the flexibility to add and change modules and install your own software.

File System

It is recommended to use a separate partition for VEs private directories (by default /vz/private/veid). The reason why you should do so is that if you wish to use OpenVZ per-VE disk quota, you wont be able to use usual Linux disk quotas on the same partition.OpenVZ per-VE disk quota is supported only for ext2/ext3 file systems. So use one of these file systems (ext3 is recommended) if you need per-VE disk quota.

Yum Pre-setup

If you want to use yum, you should set up OpenVZ yum repository first.

# cd /etc/yum.repos.d
# wget
# rpm import

Install Kernal using yum

# yum install ovzkernel[-flavor]

Using rpm

# rpm -ihv ovzkernel[-flavor]*.rpm

Configuring the bootloader

In case GRUB is used as the boot loader, it will be configured automatically: lines similar to these will be added to the /boot/grub/grub.conf file:
title Fedora Core (2.6.8-022stab029.1)
root (hd0,0)
kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5 quiet rhgb vga=031B
initrd /initrd-2.6.8-022stab029.1.img

title OpenVZ (2.6.8-022stab029.1)
root (hd0,0)
kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5
initrd /initrd-2.6.8-022stab029.1.img

Installing the utilities

OpenVZ needs some user-level tools installed. Those are:
A utility to control OpenVZ VPSs (create, destroy, start, stop, set parameters etc.)
A utility to manage quotas for VPSs. Mostly used indirectly (by vzctl).
Using yum..
# yum install vzctl vzquota
Using rpm..
# rpm -Uhv vzctl*.rpm vzquota*.rpm

Starting OpenVZ

# /sbin/service vz start

Creating an OS template cache

An OS template cache is an OS template installed into a VE and then packed into a gzipped tarball. Using such a cache, a new VE can be created in a matter of minutes, if not seconds. OS template cache can either be created from OS template metadata using vzpkg tools, or by other means.
You have to install a few packages in order to be able to create/update OS template cache

&nbspUsing yum
# yum install vzpkg vzyum vzrpm43-python vzrpm44-python
&nbspUsing rpm
# rpm -ihv vzpkg*.rpm vzyum*.rpm vzrpm44*.rpm

Installing OS template metadata

As an alternative to creating a cache using template metadata, you can use precreated template cache taken from Downloads Templates Precreated, or directly from, However, this option is not recommended for production systems since without installing template metadata you will not be able to update your template cache. In order to use precreated template cache files, download files for chosen OS distributions and place them as-is (no unpacking needed) to the /vz/template/cache directory.

VE Creation

# vzctl create VEID ostemplate osname
# vzctl set VEID ipadd a.b.c.d save
# vzctl start VEID

Here VEID is the numeric ID for the VE; osname is the name of the OS template for the VE, and a.b.c.d is the IP address to be assigned to the VE.


# vzctl create 101 ostemplate fedora-core-5-minimal
# vzctl set 101 ipadd save
# vzctl start 101

VE should be up and running now; you can see its processes

# vzctl exec VEID ps ax

To provide VEID password

# vzctl exec VEID passwd username

To enter VE give the following command:

# vzctl enter VEID
entered into VPS VEID

To exit from VE, just type exit and press enter:

[ve]# exit
exited from VPS VEID

To stop VE

# vzctl stop VEID
Stopping VPS
VPS was stopped
VPS is unmounted

To destroy VE

# vzctl destroy VEID

Destroying VPS private area: /vz/private/VEID
VPS private area was destroyed

The Vps configuration file

# vi /etc/vz/conf/XXX.conf

Article Authored by Bobbin Zacharia

Author, Bobbin, is a Systems Engineer with SupportPRO. Bobbin specializes in Cpanel and Linux server security. SupportPRO offers 24X7 technical support services to Web hosting companies and service providers.

If you require help, contact SupportPRO Server Admin

Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value

Leave a Reply