NOTE: the instance vserver name 'admin' does not work.

Gather the files associated with the packages we want

this requires the debian package apt-rdepends.
this script is located and run within the reference (zunzuncito).

usage:
zunzuncito> rdepends apache
would return all the files that package 'apache' needs to run

to run on the host server:
host> vserver zunzuncito exec /root/rdepends apache

zunzuncito:/root/rdepends:

#!/bin/sh
 
excludes='not found|not installed|to examine archive files|to list their contents|/usr/share/doc|/usr/share/man'
 
tmpfile=/tmp/rdepends.$$
 
for i in $@; do
  dpkg -L $i >> $tmpfile
  for package in `apt-rdepends $i | grep 'Depends:' | awk '{print $2}' | sort -u`; do
    dpkg -L $package 2>&1 | egrep -v "$excludes" | cat >> $tmpfile;
  done
done
 
sort -u $tmpfile
rm $tmpfile

Create a new vserver

This command will create a new vserver:
host# /root/update-links <vserver name> [packages...]

for example
host# /root/update-links blue apache php4

This script does four things:
  • creates the vserver instance directory if needed
  • unifies new vserver with reference by creating hard links from reference vserver to our new vserver for the specific files we will need in the new vserver. we use hard links so that the instance doesn't take up more space.
  • removes files which are in the instance but not in the reference. we exclude the directories /var /home and /etc/apache/conf.d from this removal step.
  • creates certain required files like /etc/hosts and /etc/hostname on the vserver.
the update-links script depends on these files:
  • host:/etc/vservers/global-files
  • host:/etc/vservers/force-depends
  • reference:/root/rdepends

Create a configuration file

for now, copy /etc/vservers/template_conf and fill in the values. conf file name must match the vserver's name, plus '.conf'

a detailed list of the capabilities (things like CAP_NET_RAW, CAP_LINUX_IMMUTABLE) can be found in /usr/include/linux/capabilities.h

Start up apache in the vserver

host# vserver $vserver exec /usr/sbin/httpd