Install Latest Stable LXC on Ubuntu & Debian

Shahriar Shovon

Supported OS

  • Ubuntu 16.04 - Xenial Xerus
  • Debian 9 - Stretch

Categories

Share this post with your friends

In this post, I will show you how to install LXC on Ubuntu and Debian.

Installing LXC on Ubuntu

On ubuntu, installing the latest stable version of LXC is very easy. All you have to do is run the following commands: sudo apt update sudo apt install lxc -y

Installing LXC on Debian

On debian, you do have lxc on debian package repository. But it doesn't have some of the lxc commands like lxc-top. You can run the following commands to install lxc from Debian package repository: sudo apt update sudo apt install lxc -y But if you want all the commands, you must compile lxc from source.

Installing LXC from Source on Debian 9 Stretch - Easiest way

Run the following commands to install the required dependecies: sudo apt install autoconf automake pkg-config build-essential libtool debootstrap rsync -y sudo apt install glibc-source uidmap cgmanager libcgmanager-dev libcap-dev libapparmor-dev libselinux1-dev libseccomp-dev libgnutls* liblua50-dev python3-dev -y Now download the lxc source tar file from https://linuxcontainers.org/lxc/downloads/, the file I am using is lxc-2.0.8.tar.gz, as this is the latest version as of this writing. wget https://linuxcontainers.org/downloads/lxc/lxc-2.0.8.tar.gz Now extract the archive with the following command: tar xvzf lxc-2.0.8.tar.gz To compile run the following commands: cd lxc-2.0.8 ./autogen.sh ./configure --prefix=/usr make && sudo make install That's it. It should take a while to compile. Once it's done, you can run the following command to test if the installation was successful. sudo lxc-ls --version It should say 2.0.8 Latest stable version of LXC has been installed on Debian 9 stretch.