Installing OpenVZ in CentOS 5.3 (64bit)

There are a few tutorials out there on installing OpenVZ in CentOS 5.3. Here are the steps I use to install OpenVZ on a brand new installation of CentOS 5.3:

Note: this tutorial / walkthrough is for use 64 bit only

  1. Update the box via yum
  2. Install the OpenVZ Repository and grab the GPG key
  3. Install OpenVZ
  4. Install OpenVZ Controller and Quota system
  5. Configure the local system for the OpenVZ kernel
  6. Update OpenVZ's ARP Settings
  7. Disable SELINUX
  8. Reboot
yum -y update
cd /etc/yum.repos.d
rpm --import
yum -y install ovzkernel.x86_64
yum -y install vzctl.x86_64 vzquota.x86_64

Now; we need to configure the sysctl.conf file for OpenVZ

perl -pi -e 's/net\.ipv4\.ip_forward = 0/net\.ipv4\.ip_forward = 1/' /etc/sysctl.conf
perl -pi -e 's/kernel\.sysrq = 0/kernel\.sysrq = 1/' /etc/sysctl.conf
echo -e "\n\nnet.ipv4.conf.default.proxy_arp = 0\nnet.ipv4.conf.all.rp_filter = 1\nnet.ipv4.conf.default.send_redirects = 1\nnet.ipv4.conf.all.send_redirects = 0\nnet.ipv4.icmp_echo_ignore_broadcasts=1\nnet.ipv4.conf.default.forwarding=1\nkernel.ve_allow_kthreads=1\n" >> /etc/sysctl.conf
perl -pi -e 's/NEIGHBOUR_DEVS=detect/NEIGHBOUR_DEVS=all/' /etc/vz/vz.conf


vi /etc/sysconfig/selinux

Reboot the machine

[ centos openvz ]