Recently I’ve started investigating Linux Virtual Containers (LXCs) to separate some of the things I’d like to play with on my hosts (a Diaspora instance, log analysis, and possibly a Nagios/FAN/Centreon instance for my own use as I start to think more about home automation, to name a few). Of course I’ve got plenty of raw hardware to build a host whenever I need to, but I’d like to realize the efficiency of having some of these items that are fairly likely to be underutilized on a single box – not to mention the time savings in comparison to rebuilding a box from scratch each time I need one.
My original intent was to wait until I had this post completed and tidied up before posting, but it may never be done in that case. So, I will instead be publishing it beginning partway through my first installation and updating as I progress through the installations. You are advised in advance that some of the content might not be overly reader-friendly; comments and corrections are welcome.
I’ve done some experimentation on my main daily use Ubuntu 10.10 Maverick release with less than stellar results (primarily due to inexperience I think) and, since I’ve been able to obtain some additional hardware, to test on an alternate box. In preparing to test, I wanted to find out which Linux distro tended to work the best for hosting LXC containers. What I came to realize is that many people seem to have experience performing installations on a single distribution or a couple of similar distributions (i.e., Debian/Ubuntu), but there doesn’t seem to be a whole lot of documentation out there that compares the experience between different distros. So I decided to find out.
Will be comparing on the same hardware, a default installation of Fedora 14, Debian 6.0.0 net install, Arch 2010.5 net install, OpenSUSE 11.3 net install, CentOS 5.5 net install, and Gentoo 2010210 minimal, all AMD/x86 64-bit. Test hardware is a Dell OptiPlex 755 Core 2 Duo at 2.53GHz with 4GB 667MHz SDRAM, 80GB SATA hard drive.
Arch – default, except changed / partition from 7500 to 8500. Most of the instruction came from https://wiki.archlinux.org/index.php/Linux_Containers, with additional information on installing AUR packages (including lxc) from https://wiki.archlinux.org/index.php/Arch_User_Repository. Accepted default packages plus OpenSSH at the initial package selection. Some minor difficulties accessing the box remotely to proceed with installation, ended up editing /etc/hosts.deny and remarking the ALL:ALL line, all was happy thereafter. Installed base-devel package with pacman -S base-devel. Downloaded the lxc package from Arch AUR and extracted with tar -zxvf lxc.tar.gz. Changed directory to lxc, ran makepkg -S –asroot then installed with pacman -U lxc-0.7.3-1-x86_64.pkg.tar.gz. Continued with installation of bridge-utils (pacman -S bridge-utils).
Edited /etc/conf.d/bridges and /etc/rc.conf to set up the network configuration. Per my primary instructional link above, noted necessary changes to /etc/rc.d/network. Downloaded the patch for the file using wget –no-check-certificate https://bugs.archlinux.org/task/16625?getfile=4176 -O network.das-patch, made a backup copy of my original file, and applied the patch using patch -p0 /etc/rc.d/network network.das-patch. Confirmed patch applied correctly by diff /etc/rc.d/network network.bak (network.bak being the name of my backup file, of course).
This seemed like a good time to do a reboot and make sure my networking config came back up properly before jumping into the actual container configuration, so I did. No response from the box after the reboot. Interestingly enough, eth0 did not restore even though br0 was showing as up. Issued an ifconfig eth0 up followed by dhcpcd br0 and was back to talking on the network. Need to do some additional research to see what happened with the networking configuration, but it’s bedtime for now. (11:00PM on 17-Feb-2011)