Building A Virtual Server (VPS) With Debian 3.1 (Sarge) And OpenVZ - Page 2
2 Install And Start Your Virtual Private Server (VPS)
OpenVZ.org offers precreated OpenVZ template caches for download:
http://openvz.org/download/template/cache/
I will show here how to install and start a Fedora 4 minimal template. The steps for the other template caches available on http://openvz.org/download/template/cache/ are exactly the same (in case you do not want to install Fedora 4 in a VPS). If you want to create your own custom templates, please have a look at chapter 3 of this tutorial.
Download the Fedora 4 template:
cd /var/lib/vz/template/cache
wget http://download.openvz.org/template/precreated/fedora-core-4-i386-minimal.tar.gz
Create the VPS. The ID of the first VPS is 101. You can choose any numeric ID, as long as the ID is > 100 and unique.
vzctl create 101 --ostemplate fedora-core-4-i386-minimal --config vps.basic
Now I set some basic settings. Configure this VPS to start automatically on boot:
vzctl set 101 --onboot yes --save
Set the hostname. Replace "test101.mytest.org" with the hostname your VPS shall have:
vzctl set 101 --hostname test101.mytest.org --save
Set the IP of the VPS. Replace 192.168.0.167 with a free IP from your network and set the number of sockets to 120:
vzctl set 101 --ipadd 192.168.0.167 --save
vzctl set 101 --numothersock 120 --save
Set the nameserver in the VPS. Replace 192.168.0.2 with a nameserver reachable from your server:
vzctl set 101 --nameserver 192.168.0.2 --save
Start the VM:
vzctl start 101
Start the SSH server:
vzctl exec 101 /etc/init.d/sshd start
Set the root password inside the virtual server:
vzctl exec 101 passwd
Now you will be able to login to the virtual server with an SSH client, e.g. PuTTY for Windows.
To see the status of the VPS, run
vzctl status 101
To stop the VPS, run this:
vzctl stop 101
To see the status of all VPS' on the system, run
vzlist -a