1. Download from http://download.openvz.org/template/precreated/
2. Copy the .tar.gz file to /vz/template/cache/. Example:
cp debian-5.0-x86.tar.gz /vz/template/cache/
vzctl create 103 --ostemplate debian-5.0-x86
Set auto start on vz start:
vzctl set 103 --onboot yes --save
Setup networkig:
vzctl set 103 --ipadd 192.168.1.103 --save vzctl set 103 --nameserver 202.64.51.214 --save vzctl set 103 --hostname lenny.example.com --save
Root Password:
vzctl set 103 --userpasswd root:sEcr2t
Set disk quota:
# set disk quota to 10G (soft limit:10G, hard limit:11G) vzctl set 103 --diskspace 10000000:11000000 --save
Set CPU usage: first check hardware node (the host the vz is running on) power by:
[root@vz vz]# vzcpucheck Current CPU utilization: 65454 Power of the node: 219999
So to give 5% of CPU Power, which is (219999 * 0.05) = 11000:
vzctl set 103 --cpuunits 11000 --save
Allocate 1G (dedicated) of host RAM:
# each page = 4096 bytes vzctl set 103 --vmguarpages $((1024000000 / 4096)) --save
vzcfgvalidate /etc/sysconfig/vz-scripts/103.conf
Remember to config the firewall to allow traffic to the VPS.
Example:
... IPVPS2011="20x.6x.5x.211" ... # allows all for VPS2011: $IPTABLES -A FORWARD -s $IPVPS2011 -j ACCEPT $IPTABLES -A FORWARD -d $IPVPS2011 -j ACCEPT ...