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.
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.
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.
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
Note
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.
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:
Partition |
Size |
---|---|
/ |
4-12 GB |
Swap |
Twice the amount of RAM |
/vz |
Rest of the space on the drive |
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/ http://ftp.openvz.org/openvz.repo
In the previous example, we use the wget
command to download the openvz.repo
file from ftp.openvz.org 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 http://ftp.openvz.org/RPM-GPG-Key-OpenVZ
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.
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.
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.
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.