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
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:
Installing LXC 2.0.x
Now I have to run the configure executable to configure Make.
export CC="gcc -Wno-maybe-uninitialized"
Build and Install LXC
Now run make && sudo make install to compile and install LXC.
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