Installing lxc - lmmx/devnotes GitHub Wiki

lxc: Getting started recommends Linux kernel >= 3.8

cat /proc/version

Linux version 4.15.0-54-generic

Check!

Extra dependencies for unprivileged containers:

  • libpam-cgfs configuring your system for unprivileged CGroups operation
  • A recent version of shadow including newuidmap and newgidmap
  • Linux kernel >= 3.12

Recommended libraries:

  • libcap (to allow for capability drops)
  • libapparmor (to set a different apparmor profile for the container)
  • libselinux (to set a different selinux context for the container)
  • libseccomp (to set a seccomp policy for the container)
  • libgnutls (for various checksumming)
  • liblua (for the LUA binding)
  • python3-dev (for the python3 binding)

The -s or --dry-run flag can show what would happen if you apt install:

sudo apt install -s libcap2 libapparmor1 libselinux1 libseccomp2 libgnutls30 liblua5.3-0 python3-dev

For me that's:

The following NEW packages will be installed
  dh-python liblua5.3-0 libpython3-dev libpython3.6-dev python3-dev python3.6-dev
The following packages will be upgraded:
  libpython3.6 libpython3.6-minimal libpython3.6-stdlib libseccomp2 python3.6 python3.6-minimal
sudo apt install libcap2 libapparmor1 libselinux1 libseccomp2 libgnutls30 liblua5.3-0 python3-dev

Then simply

sudo apt install lxc

You will now have all of the lxc-* commands:

lxc-attach         lxc-config         lxc-device         lxc-monitor        lxc-unfreeze       
lxc-autostart      lxc-console        lxc-execute        lxc-snapshot       lxc-unshare        
lxc-cgroup         lxc-copy           lxc-freeze         lxc-start          lxc-update-config  
lxc-checkconfig    lxc-create         lxc-info           lxc-stop           lxc-usernsexec     
lxc-checkpoint     lxc-destroy        lxc-ls             lxc-top            lxc-wait 

The command lxc is (confusingly!) actually a command for the "LXD client", not lxc.

The LXD-client lxc is a command tool to manage your LXD servers.

To get that, see Installing lxd which also contains links to Stephane Graber's blog to read more