LinuxContainers

Differences between revisions 2 and 3
Revision 2 as of 2009-06-14 06:41:33
Size: 1804
Editor: eskimo
Comment:
Revision 3 as of 2009-06-14 06:43:50
Size: 1908
Editor: eskimo
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Linux Containers =
Line 11: Line 9:
First make sure you have git, move to a sane working dir, and get the source. I did the following as root because I'm lazy ;P. It gets the latest source from daveh's repository which I think is the mainline kernel with container support, then copies your running kernels config to the new kernels source dir, then updates the config file ({{{make oldconfig}}}, just use the defaults for all settings), then you run {{{make menuconfig}}} and select "Container Support" from under "General Setup", then we build a package and install it (tested on jaunty 9.04 amd64) First make sure you have git, move to a sane working dir, and get the source. I did the following as root because I'm lazy ;P. It gets the latest source from daveh's repository which I think is the mainline kernel with container support, then copies your running kernels config to the new kernels source dir, then updates the config file ({{{make oldconfig}}}, just use the defaults for all settings), then you run {{{make menuconfig}}} and select "Container Support" from under "General Setup", then we build image & headers packages and install them (tested on jaunty 9.04 amd64).
Line 23: Line 21:
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
cd ..
dpkg -i linux*.deb

Linux Containers are lightweight virtualisation, similar to FreeBSD's Jails and Solaris's Zones. They require a few patches to the kernel and make use of new kernel features for process scheduling, isolation and network isolation between containers. They are flexible to the point where you can run a single process in one, or an entire virtual environment with a virtual root filesystem (obviously using the same kernel as the host).

Requirements

Ok so they are a little tricky to setup, you will need to patch or compile your own kernel (compiling your own is what I will document, using your existing config) and then compile lxc from source as the packages for ubuntu suck/aren't very stable (They should eventually be packaged, but seeing as they don't run on the stock kernel its a bit tricky atm, may as well wait till karmic)

Getting and Compiling a kernel with Container Support

First make sure you have git, move to a sane working dir, and get the source. I did the following as root because I'm lazy ;P. It gets the latest source from daveh's repository which I think is the mainline kernel with container support, then copies your running kernels config to the new kernels source dir, then updates the config file (make oldconfig, just use the defaults for all settings), then you run make menuconfig and select "Container Support" from under "General Setup", then we build image & headers packages and install them (tested on jaunty 9.04 amd64).

sudo su
apt-get install git-core kernel-package fakeroot build-essential ncurses-dev
cd /usr/src/
git clone git://git.kernel.org/pub/scm/linux/kernel/git/daveh/linux-2.6-lxc.git
cd linux-2.6-lxc
cp /boot/config-`uname -r` .config
make oldconfig
make menuconfig
make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
cd ..
dpkg -i linux*.deb

LinuxContainers (last edited 2009-06-14 07:17:41 by eskimo)