lenny can be replaced by e.g. etch for Debian etch, edgy for Ubuntu edgy, or sid for Debian sid. Anything your debootstrap version can handle will be fine.

lenny can be replaced by e.g. etch for Debian etch, edgy for Ubuntu edgy, or sid for Debian sid. Anything your debootstrap version can handle will be fine.

−

If you want to build a 32-bit guest on a 64-bit host, append <code>-- --arch i386</code> to the above command line.

+

If you want to build a 32-bit guest on a 64-bit host, append <code>-- --arch i386</code> to the above command line. The same applies to other additional debootstrap options: place them after a second <code>--</code>. Likewise, in case your host architecture does not match one available in Debian by default, add your architecture in the same way. E.g. you might need to add <code>-- --arch amd64</code> to create a 64-bit Debian guest on a Gentoo host.

+

+

Please note that <code>vserver...pkgmgmt</code> has has no use on Debian guests: package management is internalized by default and cannot be externalized. To externalize package management on Debian vserver guests, you have to create the guest using the <code>newvserver</code> command from the <code>vserver-debiantools</code> Debian package (see the <code>--pkgcache</code> option). Note that newvserver is considered obsolete and only suited for those who want to foot themselves in shoot.

+

=== Building guests using the yum build method ===

=== Building guests using the yum build method ===

Line 22:

Line 25:

* Build a CentOS 5-based guest using a minimal set of packages.

* Build a CentOS 5-based guest using a minimal set of packages.

−

vserver vserver2 build -m yum --context 42 \

+

vserver vserver2 build -m yum --[[context]] 42 \

--hostname vserver2.mydomain.com \

--hostname vserver2.mydomain.com \

--interface eth0:192.168.1.11/24 -- -d centos5

--interface eth0:192.168.1.11/24 -- -d centos5

Line 45:

Line 48:

* Build a guest using a single template named stage4-i686-20070905.tar.bz2 located in /vservers/.templates.

* Build a guest using a single template named stage4-i686-20070905.tar.bz2 located in /vservers/.templates.

vserver vserver3 build -m template \

vserver vserver3 build -m template \

−

--context 42 --hostname vserver3.mydomain.com \

+

--[[context]] 42 --hostname vserver3.mydomain.com \

--interface eth0:192.168.1.12/24 \

--interface eth0:192.168.1.12/24 \

--initstyle gentoo -- -d gentoo \

--initstyle gentoo -- -d gentoo \

Line 54:

Line 57:

* Build a guest using multiple templates, one named stage4-i686-20070905.tar.bz2 and one named httpd.tar.bz2.

* Build a guest using multiple templates, one named stage4-i686-20070905.tar.bz2 and one named httpd.tar.bz2.

There are three parts to the vserver ... build command. Each part is separated by --. The first part are generic vserver options, such as hostname, available IP-addresses, and context id. The second part is specific to the chosen build method (by -m <method> in the first part). The third part is completely optional and only implemented for a few build methods. These are options passed directly to whatever application is used to build guest.

There are a lot of options not covered here (yet). Use vserver - build --help to see them all.

lenny can be replaced by e.g. etch for Debian etch, edgy for Ubuntu edgy, or sid for Debian sid. Anything your debootstrap version can handle will be fine.

If you want to build a 32-bit guest on a 64-bit host, append -- --arch i386 to the above command line. The same applies to other additional debootstrap options: place them after a second --. Likewise, in case your host architecture does not match one available in Debian by default, add your architecture in the same way. E.g. you might need to add -- --arch amd64 to create a 64-bit Debian guest on a Gentoo host.

Please note that vserver...pkgmgmt has has no use on Debian guests: package management is internalized by default and cannot be externalized. To externalize package management on Debian vserver guests, you have to create the guest using the newvserver command from the vserver-debiantools Debian package (see the --pkgcache option). Note that newvserver is considered obsolete and only suited for those who want to foot themselves in shoot.

If you want to build a 32-bit guest on a 64-bit, prepend linux32 to this and subsequent yum commands.

If you want to manage the packages inside the guest, you will have to install some package management program(s) as well as internalize the RPM database. This can be achieved by

vyum vserver2 -- install yum
vserver vserver2 pkgmgmt internalize

Internal package management means that commands such as rpm, yum and rpmbuild can be used from inside the guest, as opposed to requiring the host administrator to run vrpm or vyum. If you use rpmbuild, you'll need internal package management, or use --nodeps (but that's strongly discouraged).

Depending on your host's/guest's distribution, you may also need to do

A template is a file containing a complete guest filesystem. This can be a tar(1)ball, a cpio(1)-archive, or a dump(8). It can be compressed using either gzip or bzip2. Multiple templates can be used, to do e.g. guest-specific modifications.

Build a guest using a single template named stage4-i686-20070905.tar.bz2 located in /vservers/.templates.

The rsync build method can be used to move a guest from one system to another. It is preferable for most guest distributions if the source guest is stopped when you create a one based on it, but it's not strictly required.

The clone build method copies the filesystem from one guest to another, much like the rsync build method, but the thing that separates it is that it knows about unified/hashified files. This means that it only creates new links for such files, and copies the rest, which can lead to significantly speedier builds.