How to create a container in OpenVZ server
In this article we are going to create a container in OpenVZ server
Prerequisites
- OS template
- Hostname
- IP address
- Name servers
Implementation:
Step:1 Create a container with an os template.
Note :
(i) We take the container ID as 104
(ii) OS template as ubuntu-18.04-x86_64
$vzctl create 104 – -ostemplate ubuntu-18.04-x86_64
Step 2: Save the container
$ vzctl set 104 – -save –onboot yes
Step 3: Specify the hostname as per your requirement
$vzctl set 104 – -save – -hostname your_hostname
Step 4: Specify the IP address
$vzctl set 104 – -save – -ipadd your_IP
Step 5: Mention the name servers.
$vzctl set 104 – -save – -nameserver IP – -nameserver IP
Step 6: Save the Number of CPU’s for the particular container as per your requirement
$vzctl set 104 – -save – -cpus 2
Step 7: Save the RAM for the particular container as per your requirement
$vzctl set 104 – -save – -ram 4G
Step 8: Save the diskspace as per your requirement
$ vzctl set 104 – -save – -diskspace 50G
Step 9: Start the container which we have created
$vzctl start 104
Step 10: Provide the strong password for the container
$vzctl exec 104 passwd
Step 11: Check the status of the container which we have created on OpenVZ server
$vzlist -a