The Perfect Setup - OpenVZ with CentOS 4.4

In this HowTo I will describe how to prepare a CentOS 4.4 server for OpenVZ virtual machines. 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.

0. Minimum Requirements
    - Hardware
    - Software
    - Other

1. Installing and Configuring Host Operating System on Hardware Node
Step #1 – Install the Base System
Step #2 – Disk Partitioning
Step #3 – Configuring Grub, Network and Security
Step #4 – Other Settings
Step #5 – Package Selection and Finalizing the system
Step #6 - Post Installation

2. Installing and Configuring OpenVZ Kernel
Step #7 - Downloading and Installing OpenVZ Kernel
Step #8 - Configuring the bootloader
Step #9 - Configuring sysctl
Step #10 - Configuring SELinux
Step #11 - Conntracks
Step #12 - Rebooting into OpenVZ kernel
Step #13 - Installing the utilities
Step #14 - Starting OpenVZ

3. OS template cache preparation
Step #15 - Installing template utilities
Step #16 - Installing OS template metadata
Step #17 - Installing repository cache (optional)

4. VE Creation and other oprations with VEs
Step #19 – Creating VE
Step #20 – Adding IP(s) to VE
Step #21 – Starting VE
Step #22 – Running ps command from Hardware Node
Step #23 - Entering VE
Step #24 - Exiting from VE
Step #25 - Stopping VE
Step #26 - Destroying VE

0. Minimum Requirements

- Hardware
    Pentium based cpu, 256 MB RAM, 6
- Software
    Any Linux distribution ( Preferred CentOS )
- Other
    NIC and Internet Connection

1. Installing and Configuring Host Operating System on Hardware Node

This section explains how to install Fedora Core 4 on the Hardware Node and how to configure it for OpenVZ. If you are using another distribution, please consult the corresponding installation guides about the installation specifics.

Info: Download the 4 CentOS 4.4 CD iso images from a mirror near you (the list of mirrors can be found here:

Step #1 – Install the Base System

Boot from your CentOS 4.4 CD (CD 1). / DVD

It can take a long time to test the installation media so we skip this test here:

The welcome screen of the CentOS installer appears. Click on Next:

Choose your language next:

Select your keyboard layout:

We want to install a server so we choose Server here:

Step #2 – Disk Partitioning

On the Disk Partitioning Setup screen, select Manual partition with Disk Druid. Do not choose automatic partitioning since this type of partitioning will create a disk layout intended for systems running multiple services. In case of OpenVZ, all your services shall run inside Virtual Private Servers.

I'm installing CentOS 4.3 on a fresh system, so I answer Yes to the question Would you like to initialize this drive, erasing ALL DATA?

Select Remove all partitions on this system.

We want to remove all Linux partitions, so we answer Yes to the following question:

Create the following partitions on the Hardware Node:

For example: 

Partition FS Type  Typical size Description
/ ext3 2-4 Gb Root partition for Hardware Node OS files
swap swap 2 times RAM Paging partition for the Linux OS
/vz ext3 Rest of available Space  Partition to host OpenVZ templates and VPSs

Share this page:

1 Comment(s)