How to Install OpenVZ 7 on CentOS 7
Introduction
OpenVZ is an operating-system-level virtualization technology for Linux. It allows a physical server to run multiple isolated operating system instances, called containers, virtual private servers, or virtual environments
Prerequisite
(i) Hardware specification
- Intel Core i7, Xeon E7, and AMD Opteron
- A minimum of 128 MB of RAM; 2 GB or more is recommended
- A hard drive with at least 80 GB of space
- A 10/100/1000 network card
(ii) Network specifications
- A valid IP address for the server
- A valid IP address for each container
Implementation
Step 1: Update and upgrade the dependencies
$ yum update && yum upgrade |
Step 2: Get OpenVZ releases
$ yum -y 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 -y localinstall https://download.openvz.org/virtuozzo/releases/openvz-7.0.15-628/x86_64/os/Packages/o/openvz-release-7.0.15-4.vz7.x86_64.rpm $ yum -y install epel-release |
Step 3: Install the Openvz releases
$ 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 |
Step 4: Clean up the CentOS repository
$ mv /etc/yum.repos.d/CentOS-* /root/ $ rpm -e –nodeps –justdb json-c $ yum -y erase jansson$ yum -y localinstall http://repo.virtuozzo.com/vzlinux/7.9/x86_64/os/Packages/j/jansson-2.10-1.vl7.1.x86_64.rpm $ yum -y localinstall http://repo.virtuozzo.com/vzlinux/7.9/x86_64/os/Packages/j/json-c-0.11-13.vl7.1.x86_64.rpm $ rpm -e –nodeps –justdb nspr nss nss-pem nss-softokn nss-softokn-freebl nss-sysinit nss-tools nss-util $ yum -y localinstall http://repo.virtuozzo.com/vzlinux/7.9/x86_64/os/Packages/n/nss-3.67.0-4.vl7.x86_64.rpm |
Step 5: Install OpenVZ kernel
$ yum -y install nss-softokn-freebl.i686 nss-tools $ yum -y install prlctl prl-disp-service vzkernel *ploop*$ yum -y update |
Note:
(i) If we have an architecture error as per the snapshot while installing the vzkernel, downgrade the glib and glibcc version then install the 32 bit dependencies
$ yum -y downgrade glibc glibc-common $ yum -y install glibc.i686 ncurses-libs.i686 |
(ii) To resolve the xz-libs architecture issue
$ wget http://mirror.centos.org/centos/7/os/x86_64/Packages/xz-libs-5.2.2-1.el7.i686.rpm $ yum install yum-utils $ yumdownloader xz-libs-5.2.2 |
Step 6: Check grub and steup Virtuozzo 7
# awk -F\’ ‘$1==”menuentry ” {print i++ ” : ” $2}’ /etc/grub2.cfg 0 : Virtuozzo 7 (3.10.0-1160.42.2.vz7.184.10) 1 : CentOS Linux (3.10.0-1160.53.1.el7.x86_64) 7 (Core) 2 : CentOS Linux (0-rescue-6a03f95fe90f43b786afa291f08bbbf6) 7 (Core) # grub2-editenv list saved_entry=Virtuozzo 7 (3.10.0-1160.42.2.vz7.184.10) |
Step 7: Reboot the server
$ reboot |
Step 8: Setup the initial settings
$ modprobe ploop pfmt_ploop1 pfmt_raw pio_direct |
Step 9: Install quota tools
$ yum -y install vzctl vzquota ploop |
Note:
(i) If we vzquota package is not available, download and configure it manually
$ wget http://download.openvz.org/utils/vzquota/3.1/src/vzquota-3.1.tar.bz2 $ mv vzquot to /usr/libecx/vz |
Step 10: Install all available Linux Distro templates
$ yum -y install *ez.noarch |
Step 11: Reboot the server
$ reboot |