Sunday, November 22, 2009

Create VPS nodes in OpenVZ

Steps for creating nodes in OpenVZ.

1. First of all check if the templates are available. Go to the vz cache directory

[root@server ~]# cd /vz/template/cache

[root@server cache]# pwd
/vz/template/cache
[root@server cache]# ll
total 1356612
-rw-r--r-- 1 root  root  158160318 Jul 10  2010 centos-4-x86.tar.gz
-rw-r--r-- 1 root  root  158609159 Sep 14 16:11 centos-4-x86.tar.gz.1
-rw-r--r-- 1 root  root  130092151 May 13  2008 centos-5-i386-default.tar.gz
-rw-r--r-- 1 root  root  191595463 Sep 14 16:16 centos-5-x86_64.tar.gz
-rw-r--r-- 1 root  root  180022352 Apr 26  2010 centos-5-x86.tar.gz
-rw-r--r-- 1 root  root  212917989 Sep 14 16:25 centos-6-x86_64.tar.gz
-rw-r--r-- 1 root  root  117087334 Nov 12  2010 debian-4.0-x86.tar.gz
[root@server cache]#
[root@server cache]#

if you do not have any templates you can download the precreated templates from the openvz website

http://wiki.openvz.org/Download/template/precreated

Once downloaded follow the steps below to create the nodes.


[root@server ~]# vzctl create 101 --ostemplate centos-5-i386-default --config vps.basic
[root@server ~]# vzctl set 101 --onboot yes --save
[root@server ~]# vzctl set 101 --hostname training.server.com --save
[root@server ~]# vzctl set 101 --ipadd 192.168.0.101 --save
[root@server ~]# vzctl set 101 --nameserver 4.2.2.2 --save
[root@server ~]# vzctl start 101
[root@server ~]# vzctl exec 101 /etc/init.d/sshd start
[root@server ~]# vzctl exec 101 passwd

Hope this helps!

No comments:

Post a Comment