This is an old revision of the document!
http://wiki.centos.org/HowTos/Virtualization/OpenVZ
OpenVZ is a form of OS virtualization based on 'containers'.
Other common forms of operating system virtualization:
OpenVZ containers offer a very high performance virtualization platform. This is primarily due to its low overhead. Containers share the common host kernel and is primarily for Linux VMs.
See Proxmox.
See OpenVZ Web Panel.
OpenVZ containers are created from templates. Since containers are not fully virtualized environments, there is no booting to CD/DVD drives or ISO images.
http://wiki.openvz.org/Physical_to_container
http://www.powerpbx.org/content/are-you-sure-you-want-revert-revision-sat-12102011-1203
Install your Centos server and application to a physical machine.
Create a Centos 5 container using an existing Centos template and shut it down.
Log into the Proxmox host.
CTID=100 rm -rf /var/lib/vz/private/$CTID mkdir /var/lib/vz/private/$CTID rsync -arvpz --exclude=/dev --exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/tmp \ -e ssh root@xx.xx.xx.xx:/ /var/lib/vz/private/$CTID/ sed -i -e 's/^[0-9].*getty.*tty/#&/g' /var/lib/vz/private/$CTID/etc/inittab grep devpts /var/lib/vz/private/$CTID/etc/fstab > /var/lib/vz/private/$CTID/etc/fstab.new mv -f /var/lib/vz/private/$CTID/etc/fstab.new /var/lib/vz/private/$CTID/etc/fstab mkdir /var/lib/vz/private/$CTID/dev mkdir /var/lib/vz/private/$CTID/mnt mkdir /var/lib/vz/private/$CTID/proc mkdir /var/lib/vz/private/$CTID/sys mkdir /var/lib/vz/private/$CTID/tmp mkdir /var/lib/vz/private/$CTID/dev/pts mkdir /var/lib/vz/private/$CTID/etc/udev/devices cd /var/lib/vz/private/$CTID chroot . MAKEDEV -d /dev -x {p,t}ty{a,p}{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f} console core full kmem kmsg mem null \ port ptmx random urandom zero ram0 MAKEDEV -d /etc/udev/devices -x {p,t}ty{a,p}{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f} console core full kmem \ kmsg mem null port ptmx random urandom zero ram0 chmod 1777 /tmp chmod 1777 /var/tmp # Disable any physical NICs by modifying the etc/sysconfig/network-scripts/ifcfg-ethX files # (where X is the interface number starting from 0) and setting ONBOOT to no. vi /etc/sysconfig/network-scripts/ifcfg-eth0 ONBOOT=no vi /etc/sysconfig/network NETWORKING_IPV6="no" vim /etc/rc.d/rc.sysinit #/sbin/start_udev vi /etc/sysconfig/init PROMPT=no vi /etc/sysconfig/selinux SELINUX=disabled # For RHEL 6 and clone distributions, you must comment out "console" in /vz/private/$CTID/etc/init/rc.conf # and /vz/private/$CTID/etc/init/rcS.conf. # # You must also delete or rename tty.conf and start-ttys.conf. # # If you do not the container will not boot up. cat << EOF >> /etc/yum.repos.d/vz.repo [vz-base] name=vz-base mirrorlist=http://vzdownload.swsoft.com/download/mirrors/redhat-el5 #mirrorlist=http://vzdownload.swsoft.com/download/mirrors/redhat-el6 gpgcheck=0 [vz-updates] name=vz-updates mirrorlist=http://vzdownload.swsoft.com/download/mirrors/updates-released-rhel5 #mirrorlist=http://vzdownload.swsoft.com/download/mirrors/updates-released-rhel6 gpgcheck=0 EOF cat >> ~/.bash_profile << EOF alias ll='ls -l' alias la='ls -A' alias l='ls -CF' alias ls="BLOCK_SIZE=\'1 ls --color=auto" alias free="free -m" export GREP_OPTIONS='--color=auto' PS1='\[\033[00;36m\]\u\[\033[00m\]@\h:\[\033[05;33m\]\w\[\033[00m\] \$ ' export HISTCONTROL=ignoredups EOF mkdir /var/lock/rpm echo " # IPv6 blacklist ipv6 blacklist net-pf-10" >> /etc/modprobe.d/blacklist.conf exit # from chroot vzctl start $CTID vzctl enter $CTID # For services info, see http://wiki.openvz.org/Physical_to_container chkconfig --list | grep :on for i in acpid apmd auditd clock consolefont cpuspeed hdparm iptables ip6tables kudzu lm_sensors lvm2-monitor mcstrans \ microcode_ctl netplugd smartd netfs ntpd portmap postfix restorecond sendmail dnsmasq wanrouter bluetooth cupsd gpm \ irqbalance; do chkconfig $i off; done