How to setup operating-system-level virtualization solution

Build your first VServer on Debian Wheezy using psand.net public repository.

Add VServer repository

Add GnuPG archive key for repo.psand.net repository to the list of trusted keys.

$ wget -q -O - http://repo.psand.net/pubkey.txt | sudo apt-key add -

Configure psand.net Public Repository.

$ echo "deb http://repo.psand.net/ wheezy main" | sudo tee /etc/apt/sources.list.d/kernel-psand.list

Update package index files.

$ apt-get update

Install required software

Install required packages.

$ sudo apt-get install linux-image-vserver-3.2-beng linux-headers-3.2.68-vs2.3.2.17-beng curl util-vserver util-vserver-build

Define default debootstrap

Create directory for default debootstrap configuration.

$ sudo mkdir -p /etc/vservers/.defaults/apps/debootstrap/

Store URL location of the debootstrap package.

$ curl -s https://packages.debian.org/wheezy/all/debootstrap/download | grep -m 1 -Eo '(http|https)://ftp.de.debian.org/debian/pool/main/d/debootstrap/[^"]+' | sudo tee /etc/vservers/.defaults/apps/debootstrap/uri

Create your first VServer

Create vserver42 with unique context id 42 and 172.0.0.42 address.

$ sudo vserver vserver42 build -m debootstrap --context 42 --hostname vserver42.mydomain.com --interface eth0:172.0.0.42/24 -- -d wheezy -m http://ftp.de.debian.org/debian

Ensure that created guest will start at boot.

$ echo "default" | sudo tee /etc/vservers/vserver42/apps/init/mark

Start the guest machine.

$ sudo vserver vserver42 start

Enter the guest machine.

$ sudo vserver vserver42 enter

References

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a system administrator working for a successful Polish company and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu