Install LXC Latest Stable from Source on Debian 9 Stretch

Shahriar Shovon

Supported OS

  • Debian 9 - Stretch

Categories

Share this post with your friends

In this article I will show you how to install/compile LXC from source on Debian 9 Stretch. These are the steps I took to install it successfully on my system. Take a look at LXC Official Website to learn more.

Clone the source from Github

First I am going to clone the stable LXC 2.0 branch from LXC's github repository. sudo apt-get update sudo apt-get install git -y git clone https://github.com/lxc/lxc.git -b stable-2.0 cd lxc/

Install required packages

Now I have to install the required dependencies for LXC. To do that, run the following command. sudo apt-get install autoconf automake pkg-config build-essential make gcc libtool debootstrap liblxc1 libapparmor-dev libcgmanager-dev libpython3-dev python3-dev libcap-dev bridge-utils rsync -y

Generate configuration file

Now I have to generate the makefile configuration program for LXC. From the lxc/ directory, run the following command: ./autogen.sh

Installing LXC 2.0.x

Now I have to run the configure executable to configure Make. export CC="gcc -Wno-maybe-uninitialized" ./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 \ --disable-doc \ --disable-rpath \ --enable-apparmor \ --disable-selinux \ --disable-lua \ --disable-tests \ --enable-cgmanager \ --enable-capabilities \ --with-distro=debian

Build and Install LXC

Now run make && sudo make install to compile and install LXC.

Testing installation

To test if everything is working, I am going to create an LXC container with the following command: sudo lxc-create -t debian -n debtest -- -r stretch Then start the container: sudo lxc-start -n debtest Log into the console: sudo lxc-attach -n debtest That's it.

References

https://www.claudiokuenzler.com/blog/517/install-lxc-from-source-ubuntu-14.04-trusty#.WaxgyNBvGUk https://stackoverflow.com/questions/30241499/debian-lxc-create-error