GICT knowledge base
A Beginners Guide to OpenVZ
Published
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 which holds an operating system. We can install multiple operating systems on their containers. OpenVZ containers have no kernel, so it uses VZkernel as common and OpenVZ containers cannot be operated using Linux kernel.
Basic terms of an OPENVZ
Templates
OS templates are modified Linux distributions, OpenVZ uses these templates to create containers on it. We can download number of operating system templates from the OpenVZ website. The template architecture must be similar to the host architecture version. Which means the host architecture is 64 bit, so you have to use 64 bit templates to create OpenVZ containers. We can choose any OS templates to install on OpenVZ containers. That is if you are running OpenVZ on a Centos6.6 machine, then you can 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 operating system templates as the guest OS. We can run different containers, but the host OS architecture and the guest OS architecture must be same.
Host OS
Host OS is the main OS which holds both OpenVZ kernel and all the other containers.
CTID
CTID or container ID is a number we can assign to every container to manage it. CTID must uniquely for every 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 select “OpenVZ” on the boot loader menu.
service name = vz
Container creation
Download precreated templates from openvz.org to /vz/template/cache location. 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 active.
# 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 diskspace 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 can be accessed in two ways
1) vzctl enter “container id”
2) ssh “IP”
If you need any further assistance please contact our support department.
Related guides
Troubleshooting Jailed Shell on OpenVZ
cPanel/WHM providing Jailed shell environment for users, this feature giving high-level security for users when doing ssh access to their server.
OpenVZCommon OpenVZ Commands for System Administrators
In this tutorial, I will show you basic OpenVZ commands to manage containers. To list all running containers. vzlist Here is the sample output.
OpenVZWHM List Account Option Shows 0 Disk Usage For cPanel Accounts
In this documentation, we can discuss about how to resolve the issue regarding, when we tried to list the cPanel accounts in WHM ‘List Accounts’ option, the
OpenVZWhen should you upgrade from Shared Hosting to VPS?
Do you have a Shared Hosting Plan with us? When you should upgrade from Shared Hosting to VPS? Before we start, you should know what is a Shared Hosting Pla
