Installing lxc-containers on Fedora hosts

During the Q&A period of my KVM presentation the other night, the world famous Mike Warfield tipped me off to the lxc-container project. Lxc-containers are a lightweight virtualization solution similar to Solaris zones and openvz, and allow you to create one or more virtual execution environments on a Linux server. It appears all of the kernel plumbing needed to support lxc-containers has been integrated (check out the various namespace projects on LWN for details) into the latest Linux kernels, and distribution support for lxc-containers is starting to trickle in.

To install lxc-containers from the source RPM on sourceforge, you will first need to make sure you have the required dependencies. On my 64-bit Fedora 11 host, I needed to install the 32-bit libcap packages to get around a “please install libcap-devel” configure error:

$ yum install libcap-devel.i586

Once the dependencies are met, you can install the lxc source RPM (the lxc source RPM contains the source code for the lxc management tools, which are used to manage LXC containers) from sourceforge:

$ rpm -ivh lxc-0.6.2-1.src.rpm

   1:lxc                   
warning: user dlezcano does not exist - using root
warning: group dlezcano does not exist - using root
########################################### [100%]
warning: user dlezcano does not exist - using root
warning: group dlezcano does not exist - using root



To build RPMS from the lxc spec file, you can run rpmbuild with the build binary option:

$ rpmbuild -vv -bb ~/rpmbuild/SPECS/lxc.spec

If this completes successfully, you can install the RPMs it created:

$ cd /root/rpmbuild/RPMS/x86_64

$ rpm -ivh lxc*.rpm

Preparing...                ########################################### [100%]
   1:lxc-devel              ########################################### [ 33%]
   2:lxc                    ########################################### [ 67%]
   3:lxc-debuginfo          ########################################### [100%]

Now that everything is installed, you can use the lxc commands to create new containers. LXC containers look pretty sweet, and I will write up a separate post later this week that describes how to manage lxc-containers on Fedora hosts. A huge shout out to Mike for tipping me off to this!

2 Comments

Dandan Liu  on October 19th, 2011

Hi!

I am very glad to read your words,and have a interest in lxc,wish you to update it!

best wishes!

dan

DekeR  on July 9th, 2012

good work!

Leave a Comment