Create a Virtual Server
Once you have OpenVZ installed you will be able to begin the process of installing individual containers.
Using the vzctl command you will be able to create a virtual server in less than 5 minutes. One of the steps that must be completed before you begin is to move the template you will use into the /vz/template/cache.
The first command uses a template and sets the configuration as a vps.basic. The 26 is a identifier for the vps. It makes sense to use the last octet of the IP Address for this identifier. Thus this is used for 192.168.4.26. In the example the centos template is used.
# vzctl create 26 – -ostemplate centos-5 –config vps.basic
Creating VE private area (centos-5-i386-default)
Performing postcreate actions
VE private area was created
This setting provides for the VE to start on boot. This is probably what you want. However, the default is not to start a VE on boot so if you do not use this setting it will remain off.
# vzctl set 26 – -onboot yes –save
# vzctl set 26 – -hostname admin26–save
# vzctl set 26 – -ipadd 192.168.4.26 –save
# vzctl set 26 – -nameserver 22.214.171.124 –save
# vzctl start 26
Starting VE …
VE is mounted
Adding IP address(es): 192.168.4.26
Setting CPU units: 1000
Set hostname: admin26
File resolv.conf was modified
VE start in progress…
# vzctl set 26 – -userpasswd root:bcrY67LD3 –save
Changing password for user root.
passwd: all authentication tokens updated successfully.
Saved parameters for VE 26
Now use vzlist to show which virtual servers are running.
# vzlist -a
VEID NPROC STATUS IP_ADDR HOSTNAME
26 16 running 192.168.4.26 admin26