Using OpenVZ

Load pre-created template cache file

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/

Create VE / VPS

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

Manage Resource

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

Verify config

vzcfgvalidate /etc/sysconfig/vz-scripts/103.conf

Firewall setup on host

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

...
tips/using_openvz.txt · Last modified: 2010-09-15 15:26 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0