How To Create a Container/VPS Machine With OpenVZ Server

After We have installed a OpenVZ VPS Master Server, We can create a container or VPS Machine on it.
Please see this URL if you still don’t have OpenVZ VPS Master Server running/installed on your server.

Create a VPS Machine in OpenVZ VPS Master Server

First we need to make sure we have a vps config in /etc/vz/conf
All vps config that we have created will store in this directory
VPS config is use to define a harddrive space, memory, and other config stuff

Example there are 3 config file there

$ls -al /etc/vz/conf

Next, We will need to make sure we have precreated template in /vz/template/cache directory

$ls -al /vz/template/cache

centos-4-i386-default.tar.gz fedora-core-5-i386-minimal.tar.gz-old
centos-4-i386-default.tar.gz-old fedora-core-6-i686-default.tar.gz
centos-4-i386-minimal.tar.gz fedora-core-7-i386-default.tar.gz
centos-4-i386-minimal.tar.gz-old fedora-core-7-i386-minimal.tar.gz
centos-5-i386-minimal.tar.gz mandriva-2006-i386-minimal.tar.gz
debian-3.1-i386-minimal.tar.gz opensuse-10-i386-default.tar.gz
fedora-8-i386-minimal.tar.gz slackware-12.0-i386-minimal.tar.gz
fedora-8-i386-minimal.tar.gz.1 ubuntu-6.06-i386-minimal.tar.gz
fedora-core-5-i386-default.tar.gz ubuntu-7.10-i386-minimal.tar.gz

If we have a config and precreated template we can start create a VPS Machine on OpenVZ VPS Master Server
We will use vzctl command to create,start,stop,destroy,etc.. the VPS Machine

Example command to create a VPS Machine:

$vzctl create NODE --config yourconfigfile --ostemplate yourostemplate --ipadd yourvpsipadd

Here is the real examples command

$vzctl create 1 --config vps.basic --ostemplate centos-4-i386-default --ipadd

Example config is : ve-vps.basic.conf-sample we can just use vps.basic in –config line command
NODE here is just numbering your VPS. we can name it 1, 100, 1000 ,etc

Next, We need to set a nameserver & Hostname for brandnew VPS Machine

$vzctl set 1 --nameserver --hostname --save

Note: Example Nameserver ip address is

After that, we can start the VPS Machine with this command

$vzctl start 1

We also can directly enter into VPS Machine from VPS Master Server

$vzctl enter 1

This command will automatically let us enter NODE 1 which is our brandnew vps
Then we can just use passwd to change the root password

If we want to exit from container/vps machine 1, it’s simple type exit


it will automatically logout and stay in OpenVZ Master VPS Machine again

To take a look a running VPS Machine type


1 46 running

Next Step is trying to connect the ip from outside network using putty.
If you are able to connect into port 22 it’s mean you are successfully configure a container/VPS Machine

If you want to stop the VPS Machine type

$vzctl stop 1

It will automatically stop container/vps machine 1 (

If you want to delete/destroy your VPS Machine, type

$vzctl destroy 1

Note : you need to stop vps machine 1 first, before destroy the vps machine

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: