Deploy-OpenVZ-7 +-Containers

Deploy OpenVZ 7 Containers

In OpenVZ containers also known as Virtual Machine or VPS. OS-level Virtualization solution that ensures containers share the resources of the physical machine. It is also called container-oriented virtualization approach that helps website operators to deploy many, separate operating system instances on a web server.

OpenVZ containers provides templates for all Linux distributions. You will need to download those templates to create a container or VPS.

STEP 1: Access OpenVZ 7 node via SSH (must be root account or with a super user privilege account)


STEP 2: Download CentOS7 Minimal
 OS Template
You can download one from http://wiki.openvz.org/Download/template/precreated.

# mkdir /vz/template/downloads 
# cd /vz/template/downloads
# wget http://download.openvz.org/template/precreated/centos-7-x86_64-minimal.tar.gz

 Convert the template so that it can be utilized by OpenVZ 7:

#/usr/libexec/ovz-template-converter --verbose /vz/template/downloads/centos-7-x86_64-minimal.tar.gz


STEP 3: Create Container

After downloading os template, execute the following commands to create new VPS.

# vzctl create 575757 --ostemplate centos-6-x86_64-minimal

Set IP Address
Note: CT configuration saved to /etc/vz/conf/575757.conf

# vzctl set 575757 --ipadd 10.168.50.124 --save

Set DNS Server

# vzctl set 575757 --nameserver 8.8.8.8 --save

Start Container on-boot

# vzctl set 575757 --onboot yes --save

Set Disk Space

# vzctl set 575757 --diskspace 80G:85G --save

Set Memory and Swap

# vzctl set 575757 --ram 4G --swap 1GB --save

Set Hostname

# vzctl set 575757 --hostname rockitpinoy.localhost.local --save

Start/Stop/Restart Container

# vzctl start 575757
# vzctl restart 575757
# vzctl --verbose stop 575757

Using the aforementioned command lines, you can now launch containers.


You can also set additional parameters provided below.

Set Root Password

# vzctl set 575757  --userpasswd root:yourpasswordhere

Set CPUs

# vzctl set 575757 --cpus 4 --save

Set CPU Units

# vzctl set 575757 --cpuunits 100000 –save

Set CPU Limit

# vzctl set 575757 --cpulimit 4 --save

Listing Container

# vzlist -a

Enter Container

# vzctl enter 575757

Destroy Container

# vzctl destroy 575757

Note: You may need to stop the container in order to delete or remove it.

Referrences:

  1. OpenVZ Official Website: https://openvz.org/
  2. OpenVZ GitHub Repository: https://github.com/openvz/vzctl
  3. OpenVZ Forum: https://forum.openvz.org/
  4. OpenVZ Documentation: https://openvz.org/Documentation
  5. OpenVZ Wiki: https://wiki.openvz.org/Main_Page
  6. OpenVZ on Twitter: https://twitter.com/openvz
  7. OpenVZ on Reddit: https://www.reddit.com/r/OpenVZ/

 

rockitpinoy
rockitpinoy
Articles: 10

Leave a Reply

Your email address will not be published. Required fields are marked *

Protected by CleanTalk Anti-Spam