OpenVZ (Open Virtuozzo) is an operating system-level virtualization technology based on the Linux kernel and operating system. OpenVZ allows a physical server to run multiple isolated operating system instances, called containers, virtual private servers (VPSs), or virtual environments (VEs). OpenVZ is similar to FreeBSD jails and Solaris Containers.
Download the OpenVZ repo.
wget -P /etc/yum.repos.d/ http://ftp.openvz.org/openvz.repo
Import OpenVZ GPG key.
rpm --import http://ftp.openvz.org/RPM-GPG-Key-OpenVZ
Install OpenVZ
yum install -y ovzkernel vzctl vzquota ploop
Modify the /etc/sysctl.conf file
# Enables the kernel magic-sysrq key kernel.sysrq = 1 # Not all the network interfaces should send redirects net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0 # Enables source route verification net.ipv4.conf.all.rp_filter = 1 # 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
Permanately disable SELinux by modifying /etc/sysconfig/selinux
SELINUX=disabled
Download a template
cd /vz/template/cache wget http://download.openvz.org/template/precreated/centos-5-x86_64.tar.gz
reboot to the default OpenVZ kernel.
Create a new container
vzctl create 1001 --ostemplate centos-5-x86_64
Modify settings
vzctl set 1001 --hostname myhost.my.domain --ipadd 192.168.1.2 --userpasswd root:[newpasswd] --save
If you wanted it to boot up with the system
vzctl set 1001 --onboot yes --save
Start / stop the container
vzctl start 1001 vzctl stop 1001 vzctl stop 1001 --fast
Enter the container
vzctl enter 1001
Run commands from within vzctl
vzctl exec 1001 service sshd status
List containers
vzlist 1001 vzlist -a
Create a computer name
vzctl set 1001 --name computer1 --save vzctl stop computer1
Source(s)
http://en.wikipedia.org/wiki/OpenVZ
http://www.linux-faqs.info/virtualization/install-openvz-and-a-centos-container
https://openvz.org/Quick_installation
https://openvz.org/User_Guide/Operations_on_Containers