Create a vserver instance
(this is done many times)
- create a new vserver
- run the vserver
- enter the vserver
This shows you how to setup a new vserver using a static IP, and use it.
create a new vserver
First create a DNS record for your new vserver that points to an available IP address.
kea IN A 69.90.134.201
Then build a new vserver using the vserver build method for debian.
Pick an unused context id:
# vserver-stat
CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME
0 55 70.9M 29M 20h56m55 8h36m09 32d07h59 root server
20 71 757.9M 376.4M 7h36m14 2h12m24 31d20h13 kariva
30 35 414M 134M 25m02s78 10m41s80 31d20h16 baderna
40 42 715M 259.7M 5h08m08 37m47s13 31d20h15 cortazar
In the above case, CTX 10 and 50+ are unused.
MAKE SURE THERE ARE NO SPACES IN THIS VARIABLE AFTER YOU SET IT!
# REMOVE_PACKAGES="sparc-utils,dhcp-client,lilo,makedev,pcmcia-cs,ppp,\
pppconfig,pppoe,pppoeconf,setserial,syslinux,fdutils,libpcap0,\
iptables,pciutils"
# vserver kea build -m debootstrap --context 10 --hostname kea --interface eth0:69.90.134.201/32 -- -d sarge -- --exclude=$REMOVE_PACKAGES
This will create a new vserver with a fresh debian installation of the
basics in $vdirbase. The configuration for your
vserver is in /etc/vserver/. The $vdirbase comes with the debian
package as /var/lib/vservers, it is defined as whatever
/etc/vservers/.defaults/vdirbase symlinks to.
run the vserver
To start your vserver, you simply need to do the following:
# vserver <vserver> start
You will see output like the following:
root@macaw:/etc/vservers# vserver kea start
ipv4root is now 69.90.134.201
Host name is now kea
New security context is 49152
Starting system log daemon: syslogd.
Starting internet superserver: inetd.
Starting periodic command scheduler: cron.
This vserver now will behave like a real server.
enter the vserver
To enter the vserver you do the following on macaw:
# vserver <vserver> enter
You will see something like the following:
root@macaw:/etc/vservers# vserver kea enter
ipv4root is now 69.90.134.201
New security context is 49152
root@kea:/# ls
bin boot dev etc home initrd lib media mnt opt proc root sbin srv sys tmp [ usr var
You are now inside your new server, all the files you see are your
vserver files, not the files on the host system. You can apt-get install
packages into your vserver just like you would on the "outside". To go
back to the host system, you simply exit from the shell.
You can also edit the files in the vserver directly from the host system in $vdirbase/
If you apt-get install sshd while in your vserver you should be able to ssh into your vserver from the outside!
|