Install LXC from upstream source on Ubuntu 18.04 Bionic

Written by - 0 comments

Published on - Listed in LXC Linux


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

Getting the source code

The source code of the LXC project is located on Github. Therefore the whole Git repository can be cloned or downloaded in zip format.

Install the packages needed to download, if you haven't installed these already:

ckadm@ubuntu:~$ sudo apt-get install git wget curl

To clone (= download) the Git repository use the git command:

ckadm@ubuntu:~$ git clone https://github.com/Napsty/lxc.git

Or use a zip file download of the current state of the repository:

ckadm@ubuntu:~$ wget https://github.com/lxc/lxc/archive.master.zip; unzip master.zip

Change into the cloned or unzipped repository:

ckadm@ubuntu:~$ if [ -d lxc ]; then cd lxc; elif [ -d lxc-master]; then cd lxc-master; fi

Compiling the source code

Before the source code can be compiled, a few packages need to be installed first:

ckadm@ubuntu:~$ sudo apt-get install build-essential automake autoconf pkg-config docbook2x libapparmor-dev libselinux1-dev libpython3-dev python3-dev libcap-dev libtool

Now everything should be ready. To create the configure command, autogen needs to be launched first:

ckadm@ubuntu:~/lxc$ ./autogen.sh

The configure command was adjusted to use the exact same paths as the LXC package from the Ubuntu repositories would use:

ckadm@ubuntu:~/lxc$ ./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 will compile the source code and create the binaries:

ckadm@ubuntu:~/lxc$ make

And make install will place the binaries into the right places (= paths):

ckadm@ubuntu:~/lxc$ sudo make install

Important note: You still need to do other preparations (e.g. create a virtual bridge) before you can launch your containers.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences