Installing linux-vserver in ubuntu

For some weird reasons, Ubuntu team has varnished all vserver-enabled kernels from their repos. And this is the only virtualization technology i’m familiar well with. We use vserver for about 1.5 year, have created some advanced configurations and, despite of all limitations like iptables being unusable inside guest or hacks to use nfs, it served very well to us being stable and causing minimum overhead.
So, after unsuccessful story with Xen for development environment of one of our projects, i’ve decided to install verver on ubuntu whatever it takes. So, here’s a brief guide on how to do it on gutsy(7.10) - i’ve installed it because somehow thought there was no vserver kernel in hardy(8.04) because it used 2.6.24xx, while vserver latest patches are for 2.6.22.19.

NOTE: this guide doesn’t cover some topics like dev-scripts package installation to be able to do apt-get source properly

  • Get a 2.6.22.19 kernel and 2.6.22.19-vs2.2.0.7 kernel patch
    - cd /usr/src/
    wget -4cS http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.19.tar.bz2
    wget -4cS http://ftp.linux-vserver.org/pub/kernel/vs2.2/patch-2.6.22.19-vs2.2.0.7.diff
    tar xjvf linux-2.6.22.19.tar.bz2
    patch -p0 < patch-2.6.22.19-vs2.2.0.7.diff
  • Get current kernel (2.6.22-15 in my case) config, build and install the kernel with it
    - cp -ax /boot/config-2.6.22-15-server linux-2.6.22.19/.config
    cd linux-2.6.22.19
    make oldconfig
    # answer few questions, i've answered yes to kernel options and default answers to vserver options
    make -j4 #i have a 2xdualcore xeon on that server ;)
    make install
    make modules_install
    update-initramfs -k 2.6.22.19-vs2.2.0.7 -c
  • Add new kernel to grub and install it
    - vim /boot/grub/menu.lst
    - title           Ubuntu 7.10, kernel 2.6.22.19-server
    root            (hd0,0)
    kernel          /vmlinuz-2.6.22.19-vs2.2.0.7 root=UUID=27b60b01-d70c-4d02-ad59-38e7515de1a9 ro
    initrd          /initrd.img-2.6.22.19-vs2.2.0.7
    - grub-install /dev/sda # or whereever you have to
  • reboot with crossed fingers :-)
  • Now we need a dietlbc, get source packages from packages.ubuntu.com
    - cd /usr/src
    mkdir dietlibc
    cd dietlibc
    wget -4cS  http://archive.ubuntu.com/ubuntu/pool/universe/d/dietlibc/dietlibc_0.31-1ubuntu3.dsc
    wget -4cS http://archive.ubuntu.com/ubuntu/pool/universe/d/dietlibc/dietlibc_0.31.orig.tar.gz
    wget -4cS http://archive.ubuntu.com/ubuntu/pool/universe/d/dietlibc/dietlibc_0.31-1ubuntu3.diff.gz
    tar xzvf dietlibc_0.31.orig.tar.gz
    mv dietlibc_0.31 dietlibc_0.31.0.orig
    gunzip dietlibc_0.31-1ubuntu3.diff.gz
    patch -p0 < dietlibc_0.31-1ubuntu3.diff
    cd dietlibc_0.31.0.orig
    debuild -us -uc
    cd ../
    dpkg -i dietlibc-dev_0.31-1ubuntu3_amd64.deb
  • Modutils package is required for util-vserver building, we need to get source packages from debian http://packages.debian.org/
    - cd /usr/src/
    mkdir modutils
    cd modutils
    wget -4cS http://ftp.de.debian.org/debian/pool/main/m/modutils/modutils_2.4.27.0.orig.tar.gz
    wget -4cS http://ftp.de.debian.org/debian/pool/main/m/modutils/modutils_2.4.27.0-6.dsc
    wget -4cS http://ftp.de.debian.org/debian/pool/main/m/modutils/modutils_2.4.27.0-6.diff.gz
    tar xzvf modutils_2.4.27.0.orig.tar.gz
    gunzip modutils_2.4.27.0-6.diff.gz
    patch -p0 < modutils_2.4.27.0-6.diff.gz
    cd modutils_2.4.27.0
    debuild -us -uc
    cd ../
    dpkg -i modutils_2.4.27.0-6_amd64.deb
  • Finally - get and build util-vserver
    - cd /usr/src
    apt-get source util-vserver
    cd util-vserver-0.30.213
    apt-get install autoconf automake1.9 autotools-dev build-essential comerr-dev debhelper dietlibc-dev dpatch e2fslibs-dev gawk gettext html2text intltool-debian libbeecrypt6-dev libtool po-debconf vlan
    debuild -us -uc
    cd ../
    dpkg -i util-vserver_0.30.213-1_amd64.deb

So if you can see the output of vserver-stat command - you’ve got a vserver ready to configure on ubuntu.

One Response to “Installing linux-vserver in ubuntu”

  1. poloniumv Says:

    Thnx, another one ubuntu-way manual.

Leave a Reply