Install LXC from source on Ubuntu 14.04 Trusty

Written by - 2 comments

Published on - last updated on August 23rd 2019 - Listed in Linux LXC


For debugging or testing new upstream versions of LXC, it is handy to install LXC from source and overwrite (if it exists) a LXC version installed through apt.

The following steps explain how to compile and install LXC from source on an Ubuntu 14.04 LTS where the same directory paths (as known from the installation through the package) are used.

Clone git repository or download current zip of master branch:

$ git clone https://github.com/lxc/lxc.git

or

$ wget https://github.com/lxc/lxc/archive/master.zip; unzip master.zip

Install required packages to build LXC:

$ sudo apt-get install build-essential automake autoconf pkg-config docbook2x libapparmor-dev libselinux1-dev libcgmanager-dev libpython3-dev python3-dev libcap-dev

Change into the cloned or unzipped repository and compile:

$ if [ -d lxc ]; then cd lxc; elif [ -d lxc-master ]; then cd lxc-master; fi

$ ./autogen.sh

$ ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu --with-rootfs-path=/usr/lib/x86_64-linux-gnu/lxc --sysconfdir=/etc --localstatedir=/var --with-config-path=/var/lib/lxc --enable-python --enable-doc --disable-rpath --enable-apparmor --enable-selinux --disable-lua --enable-tests --enable-cgmanager --enable-capabilities --with-distro=ubuntu

$ make; sudo make install

You can then verify that the lxc scripts are built against the new version (as of today the current version in master is 1.1.0-alpha2):

$ ldd /usr/bin/lxc-start | grep liblxc
        liblxc.so.1 => /usr/lib/x86_64-linux-gnu/liblxc.so.1 (0x00007f2c9e58b000)

$ ll /usr/lib/x86_64-linux-gnu/liblxc.so.1
lrwxrwxrwx 1 root root 22 Nov 26 13:31 /usr/lib/x86_64-linux-gnu/liblxc.so.1 -> liblxc.so.1.1.0.alpha2



Add a comment

Show form to leave a comment

Comments (newest first)

ck from Switzerland wrote on Oct 18th, 2016:

Hi El Mario, configure is on the page, too :-) But I didn't simply launch "./configure", I added a bunch of paths into the command.


ElMario from wrote on Oct 17th, 2016:

Hello, and thank you for the help!
I never know where to start with all these scripts and buildtools..

It seems like you forgot one step:
After ./autogen.sh we need to ./configure

Bye :)