How to install OpenVZ in Centos 5.3

Today, I want to show you how to install OpenVZ in Centos. OpenVZ is container-based virtualization for Linux. You can create multiple secure, isolated containers. Just need a single physical server. Containers also known as VEs or VPSs. Each container performs like a stand-alone server. OpenVZ is free open source software.

I will not show installation of CentOS. You can learn it from elsewhere.

Yum Configuration

You have to download yum-repo of OpenVZ in your /etc/yum.repos.d/. Following commands must be run under root.

# cd /etc/yum.repos.d
# wget http://download.openvz.org/openvz.repo
# rpm –import  http://download.openvz.org/RPM-GPG-Key-OpenVZ

If you cant cd to /etc/yum.repos.d/,  it means yum isnt installed on your system.

Kernel Setup

We have installed repo into yum. Now time to use it.

# yum install ovzkernel

If you are using Grub for bootloader, it will be automatically configured for OpenVZ. You can see it in /boot/grub/grub.conf after the installation.

Configuring

Some kernel parameters must be configured. These parameters are stored in /etc/sysctl.conf file. Here is the necessary configuration:

# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
net.ipv4.ip_forward = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.default.proxy_arp = 0

# Enables source route verification
net.ipv4.conf.all.rp_filter = 1

# Enables the magic-sysrq key
kernel.sysrq = 1

# We do not want all our interfaces to send redirects
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0

SELinux

SELinux must be disabled. You can disable it in /etc/sysconfig/selinux. Just add the following line.

SELINUX=disabled

Now, reboot the machine with OpenVZ kernel. If it boots normally, you can install the tools.

vzctl: Control to OpenVZ containers

vzquota: Manage quotas for containers.

yum install vzctl vzquota

Starting OpenVZ

We have installed OpenVZ and trying to start it.

service vz start

Sorry for errors in text, my english isnt good.

1 Response to “How to install OpenVZ in Centos 5.3”


  1. 1 virtual levent

    gardaş türkçe yazaydında bizde okuyaydık …

Leave a Reply




Ahm is Digg proof thanks to caching by WP Super Cache