OpenVZ Essentials

By Mark Furman
    What do you get with a Packt Subscription?

  • Instant access to this title and 7,500+ eBooks & Videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
About this book

OpenVZ (Open Virtuozzo) is an OS-level virtualization technology based on the Linux kernel and OS written in C. It creates multiple secure and isolated Linux containers on a single physical server, enabling better server utilization and ensuring that applications do not conflict. OpenVZ is the only highly scalable virtualization technology with near-zero overhead, strong isolation, and rapid customer provisioning that's ready for production use right now.

Starting with the very basics of OpenVZ, you will learn to configure templates, create containers, administer your server infrastructure, and utilize the OpenVZ Web Panel.

Packed with practical examples and precise instructions, this book helps you to set up and configure OpenVZ. An easy-to-follow guide that will help you with real-world container administration tasks. The book has a natural flow from one topic to another and will ensure that you gain expertise in the effective implementation of OpenVZ.

Publication date:
November 2014


Chapter 1. Installing OpenVZ

In this chapter, we are going to explain what OpenVZ is and the system requirements we need to install OpenVZ on our system. Then we are going to walk through configuring yum to use the OpenVZ repo and install the vzkernel.

Finally, we are going to talk about installing additional packages to help manage containers on the node—vzctl to create, configure, and remove containers and vzquota to manage quotas.


What is OS-level virtualization?

OS-level virtualization is a type of virtualization that is kernel-based. It depends on a host OS to manage, create, and configure containers on the host server through a specialized kernel.

Another type of virtualization is bare bones virtualization; this type of virtualization differs from the OS-level virtualization by providing a small OS that is booted instead of a host OS such as Windows or Linux. This type of virtualization is used to reduce the resource overhead on the host OS.


What is OpenVZ?

OpenVZ is a OS-level virtualization software that allows you to run isolated, secured containers that use a modified version of the Linux kernel to split the physical server to allow you to run multiple isolated containers, sometimes also called virtual private servers, that act as their own independent servers and have their own properties that are:

  • Root account

  • Users

  • Filesystem and quotas

  • Processes

  • Memory limits

  • CPU quotas

  • Network configuration

Each of the containers shares the same hardware and resources from a single physical server called a node.

The operating systems on the server cannot be mixed; they must run the same operating system as the physical server. Since you are using Linux for OpenVZ, you can only install Linux containers, although you can use different distributions of Linux for each of your containers.


System requirements

For this book, you are going to use CentOS 6.5 as the distribution OS in all the examples. You can also follow RHEL6.5, Scientific Linux, or Debian 7 along with this book. At the time of this writing, the OpenVZ kernel version that is available is vzkernel 2.6.32 and will be the OpenVZ kernel that is used throughout the rest of this book.

For hardware specifications, the following are recommended:

  • IBM PC compatible computer

  • Intel Core i7, Xeon E7, and AMD Opteron

  • A minimum of 128 MB of RAM; 2 GB or more is recommended

  • A hard drive with at least 80 GB of space

  • A 10/100/1000 network card

For network specifications, the following are recommended:

  • A local area network for the server

  • A valid Internet connection

  • A valid IP address for the server

  • A valid IP address for each container


Please note that the previously listed requirements are recommended to get you started with learning how to use OpenVZ. On a live server, you will want to increase the RAM and CPU as the number of your containers grows on the server. It is not unusual to see a server with three to four CPUs with two or more cores at 3.4 GHz per core and 90 GB of RAM.


The disk partition scheme

You will create a / partition for Centos 6.5 and a swap partition to manage the virtual memory on the server and a /vz partition to store the containers that are created on the server.

When installing your Linux distribution, you will want to configure your disk partition scheme to the following:




4-12 GB


Twice the amount of RAM


Rest of the space on the drive


The yum configuration

First, we will start by adding the OpenVZ repo to the repos.d directory under /etc/yum/; you can do this by running the following command:

wget -P /etc/yum.repos.d/

In the previous example, we use the wget command to download the openvz.repo file from to install openvz.repo on your server.

Then, import the OpenVZ GPG key used to sign the packages by running the following command:

rpm --import

In the previous example, we use the rpm command to import the GPG key for openvz.repo to validate the package as a signed package.


Installing vzkernel

Vzkernel is the core of OpenVZ; it is essentially a modified version of the Linux kernel that allows you to run containers on your server.

To install vzkernel, you will want to run the following command:

yum install vzkernel

In the previous example, we use the yum command with the install option to install vzkernel on our server.


Installing vzctl and vzquota

In this section, we are going to go over the additional tools that are needed to install the vzkernel. The tools are as follows:

  • vzctl: This is an OpenVZ utility tool that allows you to directly interface with the containers. You can use this utility to start, stop, suspend, destroy, and create containers. We will go over this utility and it's usage in more detail in a future chapter.

  • vzquota: This is an OpenVZ utility that allows you to configure disk quotas on your server. You can use this utility to initialize, turn quotas on, turn quotas off, set limits, and show quota stats. We will go over this utility and it's usage in more detail in a following chapter.

To install the utilities, you will need to run the following command:

yum install vzctl vzquota

In the previous example, we use the yum command to install the packages for vzctl, vzquota, and ploop on the server.


Restarting the server

The last step you need to perform is rebooting your server by executing the following command. When the server comes back up, your OpenVZ installation will be complete and you will have a running OpenVZ server.

shutdown -r now


In this chapter, we discussed what OpenVZ is and walked through the system requirements to install OpenVZ, including hardware and networking requirements. Finally, we walked through the steps needed to install OpenVZ—configuring yum, and installing the vzkernel and additional utilities: vzctl and vzquota.

In the next chapter, you are going to learn how to download and use OS templates to create containers on the server as well as how to create a container and set up the hostname, IP address, and DNS for it.

About the Author
  • Mark Furman

    Mark Furman is currently working as a systems engineer for Info-Link Technologies. He has been in the IT field for over 10 years and specializes in Linux and open source technologies. In the past, he has worked as an independent IT contractor providing consulting services for small- to medium-sized businesses and as a Linux administrator for HostGator. He has also been managing his own IT company for several years.

    Mark can be reached at He can also be found at and

    Browse publications by this author
OpenVZ Essentials
Unlock this book and the full library FREE for 7 days
Start now