OpenVZ is an OS-level virtualization technology for Linux. It allows a physical server to run multiple operating systems on it. We can call these platforms containers or VPS. OpenVZ is a container that holds an OS. We will install multiple operating systems on their containers. OpenVZ containers have no kernel, so it uses VZkernel as common and OpenVZ containers can’t be operated using Linux kernel.
Basic terms of an OpenVZ
Templates
Operating System templates are modified Linux distributions, OpenVZ uses these templates to make containers on it. We will download a number of OS templates from the OpenVZ website. The template architecture must be almost to the host architecture version. This means the host architecture is 64 bit, so you’ve to use 64-bit templates to make OpenVZ containers. We will select any OS templates to install on OpenVZ containers. That is if you’re running OpenVZ on a Centos6.6 machine, then you’ll also create a container with Debian template on that machine.
Guest OS
The guest OS is the operating system. Which runs inside the container. We use OS templates as the guest OS. We can run different containers, but the host OS architecture and the guest OS architecture must be the same.
Host OS
Host OS is the main OS that holds both the OpenVZ kernel and all the other containers.
CTID
CTID or container ID is a number we will assign to each container to manage it. CTID must be unique for each container.
OpenVZ configuration
Download openVZ.repo file to your /etc/yum.repos.d/ repository.
# wget -P /etc/yum.repos.d/ https://download.openvz.org/openvz.repo
Import OpenVZ GPG key used for signing RPM packages
# rpm –import http://download.openvz.org/RPM-GPG-Key-OpenVZ
# yum install vzkernel
SELinux should be disabled. So, put Disable Selinux in /etc/sysconfig/selinux.
OpenVZ needs user-level tools installed:
# yum install vzctl vzquota ploop
Now reboot the system and choose “OpenVZ” on the boot loader menu.
service name = vz
Container creation
Download procreated templates from openvz.org to /vz/template/cache location. The downloaded file will be a tar extension file, which doesn’t need to be extracted in the directory. Before the container creation, check whether the service vz is running actively.
# service vz restart
# vzctl create 101 –ostemplate “os name that we downloaded (without .tar extension)”
Assign the container IP:
# vzctl set 101 –ipadd “IP” –save
Set preferred public DNS IP
# vzctl set 101 –nameserver “. . . .” –save
Set the hostname for the container
# vzctl set 101 –hostname “hostname” –save
Assign disk space for the container
# vzctl set 101 –diskspace “size(eg: 2G)” –save
Set password for root
# vzctl set 101 –userpasswd root:hostname
Set the ram space for the container
# vzctl set 101 –ram “ram size (eg: 256M)” –save
check container details
# vzlist -a
Then start the container
# vzctl restart 101
Finally, the containers are often accessed in two ways
1) vzctl enter “container id”
2) ssh “IP”
If you would like any longer assistance please contact our support department.