Archive for the tag 'OpenVZ'

Create and starting a openvz container.

To create and start a container, run the following commands:

# vzctl create CTID –ostemplate osname
# vzctl set CTID –ipadd a.b.c.d –save
# vzctl set CTID –nameserver a.b.c.d –save
# vzctl start CTID

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


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

Installing OpenVZ

Installing OpenVZ

OpenVZ is operating system-level virtualization based on a modified Linux kernel that allows a physical server to run multiple isolated instances known as containers, virtual private servers (VPS), or virtual environments (VE).

Installing OpenVZ on a CentOS 4 or CentOS 5

Download -

Import the OpenVZ key

rpm –import

Install the OpenVZ kernel

Depending on which kernel arch you want, simply do:

yum install ovzkernel.i386


yum install ovzkernel.x86_64

Reference -

1) Examine /etc/grub.conf to ensure the desired kernel is set to be the default,

2) Edit the /etc/sysctl.conf to enable some kernel features that are needed for OpenVZ and

3) Make sure SELINUX is disabled.

Resources available for OpenVZ containers.

Resources that can be set, include disk space usage, memory usage, CPU usage, and more.

Restricting and setting hard limits of what is permitted in a container ensures that no tasks within the container can get greedy and steal resources from other containers or the host system itself.

First, look at the vzlist tool. This will provide information on any installed containers which makes managing them simpler vzlist tool

This will provide information on any installed containers which makes managing them simpler:

# vzlist -a

How to increase the available disk space from 1GB to something more useful like 10GB.

Check disk space.

# vzctl exec 101 df -hT

The above increases the default 1GB drive space available to a barrier of 10GB and a maximum limit of 11GB.

# vzctl set 101 –diskspace 10G:11G –save
# vzctl exec 101 df -hT

There are two ways to change settings for containers. The first is using vzctl as above (remember to use the -save option to make the changes persistent). The second is to edit the configuration file for the container. For a container with a CTID of 101, the file would be /etc/sysconfig/vz-scripts/101.conf.