OpenVZ – how-to create a VPS
Posted by Florian N in Unix general, tags: openvz new vps, openvz vps, setup new vpsAs a few days ago i was writing about installing OpenVZ and the operation commands i was thinking that this would go nice under it as a follow-up .
Installing a template is pretty easy :
[root@test ~]#yum -y vztmpl-centos-5-2.0-2 //install the template for Centos 5
[root@test ~]#vzpkgcache //create the cache, a lot of packages will be installed
[root@test ~]#vzpkgls //check the templates installed
The output for the last command will be similar to:
centos-5-i386-default
centos-5-i386-minimal
Now that we installed the templates for Centos 5 we can go ahead and create out first VPS:
[root@test ~]#vzctl create 101 --ostemplate centos-5-i386-default --config vps.basic //This will create a VPS with the ID 101 using the Centos 5 template(also 0-100 for the VPS ID is not possible to use)
Running the create command will send you this output so you know it is created:
Creating VE private area (centos-5-i386-default)
Performing postcreate actions
VE private area was created
Now a few things will have to set for the VPS like to be started at boot server time, set the IP, hostname, password and such.
[root@test ~]#vzctl set 101 --onboot yes --save
Saved parameters for VE 101
[root@test ~]#vzctl set 101 --ipadd 192.168.0.3 --save
Saved parameters for VE 101
[root@test ~]#vzctl set 101 --hostname server.server-hostname.com --save
Saved parameters for VE 101
[root@test ~]#vzctl set 101 --nameserver 192.168.0.2 --save
Saved parameters for VE 101
[root@test ~]#vzctl set 101 --userpasswd root:password //This last command will set the password for user root on the VPS
Now we are ready to start the VPS:
[root@test ~]#vzctl start 101
Starting VE ...
VE is mounted
Adding IP address(es): 192.168.0.3
Setting CPU units: 1000
Set hostname: server.server-hostname.com
File resolv.conf was modified
VE start in progress...
Let’s start the ssh on the VPS from the node server using exec
[root@test ~]#vzctl exec 101 service sshd start
Starting sshd: [ OK ]
Check the VPS if it is running:
[root@test ~]#vzlist
VEID NPROC STATUS IP_ADDR HOSTNAME
101 16 running 192.168.0.3 server.server-hostname.com
A last thing to do so that the VPS will be ready for direct use/access is to install yum on the VPS:
[root@test ~]#vzyum 101 install yum
If all this run with no problems you have the first VPS up running Centos 5.

Entries (RSS)
mozhe da se registriram tuka da se napravam eden server.
ako mozhete ta mi pomognetet po ubavoo