User Rating
( votes)
Installing OpenVZ on a new server
First, the OpenVZ repository must be installed:
wget http://download.openvz.org/openvz.repo -O /etc/yum.repos.d/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
Then, you have to run the following to actually install openvz:
yum -y install ovzkernel.x86_64 vzquota.x86_64 vzctl.x86_64
Change this to i386 if you’re on an x86 machine
Next, edit /etc/vz/vz.conf. There are two changes you have to make here. NEIGHBOUR_DEVS should be ‘all’ to fix some arp problems, and you must add this line for CSF compatibility:
Then run the following modprobe commands:
modprobe ipt_MASQUERADE && echo "modprobe ipt_MASQUERADE" >> /etc/rc.modules modprobe ipt_helper && echo "modprobe ipt_helper" >> /etc/rc.modules modprobe ipt_REDIRECT && echo "modprobe ipt_REDIRECT" >> /etc/rc.modules modprobe ipt_state && echo "modprobe ipt_state" >> /etc/rc.modules modprobe ipt_TCPMSS && echo "modprobe ipt_TCPMSS" >> /etc/rc.modules modprobe ipt_LOG && echo "modprobe ipt_LOG" >> /etc/rc.modules modprobe ipt_TOS && echo "modprobe ipt_TOS" >> /etc/rc.modules modprobe iptable_nat && echo "modprobe iptable_nat" >> /etc/rc.modules modprobe ipt_length && echo "modprobe ipt_length" >> /etc/rc.modules modprobe ipt_tcpmss && echo "modprobe ipt_tcpmss" >> /etc/rc.modules modprobe iptable_mangle && echo "modprobe iptable_mangle" >> /etc/rc.modules modprobe ipt_limit && echo "modprobe ipt_limit" >> /etc/rc.modules modprobe ipt_tos && echo "modprobe ipt_tos" >> /etc/rc.modules modprobe iptable_filter && echo "modprobe iptable_filter" >> /etc/rc.modules modprobe ipt_helper && echo "modprobe ipt_helper" >> /etc/rc.modules modprobe ipt_tos && echo "modprobe ipt_tos" >> /etc/rc.modules modprobe ipt_ttl && echo "modprobe ipt_ttl" >> /etc/rc.modules modprobe ipt_REJECT && echo "modprobe ipt_REJECT" >> /etc/rc.modules
Finally, edit /etc/sysctl.conf and set net.ipv4.ip_forward = 1 then reboot. You should be ready to go now.