Setting Up Linux OpenVZ Virtualization

Installing the OpenVZ Kernel

The simplest Linux distribution to setup OpenVZ hosting support for is CentOS, as a kernel and packages are supplied by the OpenVZ developers at https://wiki.openvz.org/Main_Page . The steps to install the kernel are on a CentOS 5 system are :

  1. Setup the OpenVZ YUM repository with the commands : cd /etc/yum.repos.dwget https://download.openvz.org/openvz.reporpm --import https://download.openvz.org/RPM-GPG-Key-OpenVZ

  2. Install the kernel with the command yum install ovzkernel . Or if you want a kernel that can host both Xen and OpenVZ, use yum install ovzkernel-xen .

  3. Edit /boot/grub/menu.lst and make sure the default= line refers to the new OpenVZ-capable kernel section - typically this will need to be set to default=0

  4. Edit /etc/sysctl.conf and append the following lines :
    # 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

  5. Edit /etc/sysconfig/selinux and change the SELINUX= line to SELINUX=disabled

  6. Reboot the system, and verify that it boots into the new kernel.

Installing OpenVZ Utilities

Once you have the kernel on the host system, other needed utilities can be installed as follows :

  1. Install the OpenVZ tools with : yum install vzctl vzquota
  2. Start the OpenVZ daemon with : /etc/init.d/vz start
  3. Run the command vzlist -a to verify that the tools are working and kernel support is usable. Once this is done, you can add this system as an OpenVZ host in Cloudmin at Host Systems -> OpenVZ Host Systems .