Home

Search this site:
 

Horshack’s
very
own site

 

This is Bavaria, Germany!
You will find links to Perl,
bootdisks for system administration,
a lot of Linux,
Windows administration
and some personal belongings.
Vserver with Debian

Vserver with Debian

How to prepare the mother-system

Configure your daemons to listen only to the IP-address of the mothersystem

  1. Replace inetd through xinetd with "apt-get install xinetd". Put this line into /etc/xinetd.conf:
    defaults {   bind = 10.95.81.15 }
  2. sshd: in file /etc/ssh/sshd_config
    ListenAddress 10.95.81.15
  3. sendmail, listen only to external ip-address, look at sendmail.html
  4. check /etc/resolv.conf for your nameserver

Are there any ports used on the mother-system which are also used in a child-system?Check with "netstat -l"

How to get the right kernel (Debian)

It is said that vserver is part of the standard-kernel from 2.4.26 on... hopefully. I you get in trouble take a look at http://www.linux-vserver.org/index.php?page=linux-vserver_administrators_guide

1. Install a ready-made kernel

Try to find a kernel-image package. I took this one: kernel-image-2.4.18ctx_rev01_i386.deb (here to download, only with <137 GBytes Harddisk). I f you have larger disks then 137 GBytes you have to have a kernel >= 2.4.20

Install kernel like this:

# apt-get install initrd-tools
# apt-get install kernel-package
# dpkg -i kernel-image-2.4.18ctx_rev01_i386.deb

Take care about /etc/lilo.conf:


# uncomment this:
message=/boot/bootmess.txt
        prompt
        # single-key
        delay=100
        timeout=100



default=li2418ctx
image=/boot/vmlinuz-2.4.18ctx
        label=linux2418ctx
        read-only
        # This is not here when you simply install the kernel-package
        # important: you get a boot panic if you don't do that
        initrd=/boot/initrd.img-2.4.18ctx
...

2. Or: compile the kernel for vserver for yourself

Here is how to compile the kernel with the patch...

How to create a new virtual server

  1. First, get the package vserver
    # apt-get install -t testing vserver
  2. Then get the package debootstrap which installs a new server into a given directory
    # apt-get install -t testing debootstrap
    (use -t testing here! without that you get errors in using debootstrap like this:
    1. remapping table
    2. no entry for main/binary-i386-none/Packages
  1. Create a file /etc/vservers.conf
  2. # Where are all your child-servers living?
    VSERVERS_ROOT=/data/vservers
    # When starting or entering a vserver, its /etc/mtab is generated on
    # the fly so it matches the various volumes mounted inside the vserver
    GENERATEMTAB=yes

  3. Create a config-file for a new server, I call mine mysql4 and it lives in /data/vservers/mysql4. Create a file /etc/vservers/mysql4.conf for this server:
  4. # Most easy thing is to have an own ip-address for each vserver
    IPROOT=10.95.81.17
    IPROOTMASK=255.255.255.0
    # How shall the networkdevice be named from the view of the vserver
    IPROOTDEV=eth0
    # shown hostname
    S_HOSTNAME=mysql5
    # lock = you are not allowed to create a new context in your context
    # nproc = let ULIMIT-value be global for this context
    S_FLAGS="lock nproc"
    ULIMIT="-H -u 1000"
    # What capabilities shall the server have? Look for explanation
    S_CAPS="CAP_NET_RAW CAP_NET_BIND_SERVICE"
    # Start this server on booting? This will be checked in /etc/init.d/vservers
    ONBOOT=yes

  5.  Install the new server mysql4 (the basic packages to let it live):
    # cd /data/vserver
    # debootstrap woody mysql4 http://ftp.de.debian.org/debian
    or
    # debootstrap woody mysql4
  6. or
    # debootstrap sarge mysql4
  1. Copy apt-config to the child-server
    # cp /etc/apt/* /data/vservers/mysql4/etc/apt/
  2. Enter the vserver and run the base-configuration:
    # vserver mysql4 start
    # vserver mysql4 enter
    # base-config

 

S_CAPS = capabilities of your server

What capabilities shall the server have? You can set these values for S_CAPS in /etc/vservers/xx.conf:

Capability

Description

CAP_NET_RAW

You can create arbitrary ip-packets

CAP_SYS_TIME

You are allowed to set time: date, netdate, xntpd

CAP_NET_BROADCAST

You are allowed to send broadcast-packets, i.e. Samba

CAP_NET_BIND_SERVICE

Bind ports below 1024

CAP_CHOWN

You are allowed to change owner of files

CAP_SYS_ADMIN

You are allowed to do everything, includes mounting filesystems!

Constants are from capability.h

The commands

Examples are for my vserver mysql5

vserver mysql5 start|stop

Start/Stop a server

vserver-stat

Status of running servers

vserver mysql5 enter

Enter the given vserver

Trouble on shutdown vserver: can't set the new security context

This is what happens:

tanzwut:~# vserver mail2 stop
Stopping the virtual server mail2
Server mail2 is running
ipv4root is now 10.95.81.71
Can't set the new security context
: Invalid argument
sleeping 5 seconds
Killing all processes
chcontext version 0.29
chcontext [ options ] command arguments ...
...

 Find out the security-context-number of your vserver:

tanzwut:/etc/vservers# vserver mail2 enter
ipv4root is now 10.95.81.71
Host name is now mail2
New security context is 2

Put this number in your /etc/vservers/[vservername].conf:

...
# Because of: Can't set the new security context
# Wenn doing "vserver mail2 stop"
S_CONTEXT=2


Last modified:
28.10.2005 07:38
Impressum
Wozu Witze ausdenken? Das Leben schreibt sie selbst:
Das haben wir jetzt 40 Jahre so gemacht, warum sollten wir das ändern?
Why inventing jokes? Real life does a better job:
We are doing it this way for 40 years, why should we change it?