FAQ » Servers
How to Install OpenVZ 7 on CentOS 7
This is a complete guide to converting a CentOS 7 server to a OpenVZ host server.
The recommended pattern to install OpenVZ is to use the ISO and install it on the bare metal.
However, that isn't always possible, so in this tutorial, we'll explain how to install OpenVZ on CentOS.
You'll need a server with CentOS 7 x86_64 installed.
I'll be using CentOS 7.9.
Update
Ensure you have everything up to date.
yum update && yum upgrade
Get OpenVZ releases
yum localinstall https://download.openvz.org/virtuozzo/releases/openvz-7.0.17-347/x86_64/os/Packages/p/python-subprocess32-3.2.7-1.vz7.5.x86_64.rpm
yum localinstall https://download.openvz.org/virtuozzo/releases/openvz-7.0.17-347/x86_64/os/Packages/o/openvz-release-7.0.17-29.vz7.x86_64.rpm
yum install epel-release -y
Install
yum install python3
rpm -Uvh http://repo.virtuozzo.com/vzlinux/7.9/x86_64/os/Packages/r/readykernel-scan-0.11-1.vl7.noarch.rpm
rpm -Uvh http://repo.virtuozzo.com/vzlinux/7.9/x86_64/os/Packages/z/zstd-1.4.4-1.vl7.x86_64.rpm
rpm -Uvh http://repo.virtuozzo.com/vzlinux/7.9/x86_64/os/Packages/v/vzlinux-release-7-1.vl7.91.x86_64.rpm
Cleanup
mv /etc/yum.repos.d/CentOS-* /root/
pm -e --nodeps --justdb json-c
yum erase jansson
yum localinstall http://repo.virtuozzo.com/vzlinux/7.9/x86_64/os/Packages/j/jansson-2.10-1.vl7.1.x86_64.rpm
yum localinstall http://repo.virtuozzo.com/vzlinux/7.9/x86_64/os/Packages/j/json-c-0.11-13.vl7.1.x86_64.rpm
yum install prlctl prl-disp-service vzkernel *ploop*
yum update -y
Check grub
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
grub2-set-default 1
grub2-mkconfig -o /boot/grub2/grub.cfg
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
Reboot
reboot
Initial Settings
modprobe ploop
modprobe pfmt_ploop1
modprobe pfmt_raw
modprobe pio_direct
Update sysctl
cat >> /etc/sysctl.conf <<EOF
# 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
#only use these if you build a NAT VPS
#otherwise, do not copy these lines
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.default.forwarding= 1
EOF
sysctl -p
Set SELINUX permissive
# sed -e s/SELINUX=disabled/SELINUX=permissive/ /etc/selinux/config
Install quota tools
yum -y install vzctl vzquota ploop
Install all available Linux Distro templates
yum install *ez.noarch
Reboot
reboot
Last updated: 2022-02-20