Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Debian 12 - Install Incus (An LXD Fork)

Introduction

Incus is a next generation system container and virtual machine manager that is a fork from Canonical's LXD. You can read more about this with the following links:

The thing that I find most exciting about Incus/LXD is the fact that it is completely controlled through a RESTful API (more info, and spec) with all communicatons being in JSON format, and configurations often being in YAML and/or JSON format. This will make it easy for me to create custom PHP scripts or web services to automate aspects of my infrastructure (on top of using Ansible/Terraform). Incus is initially only focused on container's, but now supports virtual machines through QEMU.

This tutorial will show you how to quickly get Incus set up on a Debian 12 host, which unlike KVM, could be a virtual private server, rather than a dedicated host.

Steps

Run the chained command below in order to install Incus on Debian 12. This will downloads the public keys that the Incus pacakges are signed with, before adding their repository to our sources, and specify that they should be checked against the key we trust.

sudo apt update && sudo apt install curl -y \
  && sudo mkdir -p /etc/apt/keyrings/ \
  &&  sudo curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc \
  && sudo sh -c 'cat <<EOF > /etc/apt/sources.list.d/zabbly-incus-stable.sources
Enabled: yes
Types: deb
URIs: https://pkgs.zabbly.com/incus/stable
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
Components: main
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/zabbly.asc

EOF' \
  && sudo apt-get update \
  && sudo apt-get install incus -y

This set of instructions is for installing the "stable" releases. There is a "daily" repository which you could configure instead. "Zabbly" is the handle of the former lead dev of the LXD project St├ęphane Graber before he left to help the Incus fork. (source)

Other Packages You May Want

Once you have done this, you may wish to install these other packages:

  • incus-client - a package containing only the CLI tool, useful when managing remote servers.
  • incus-ui-canonical - a package containing a rebranded version of the LXD web interface for use with Incus.

Incus Setup

Once one has installed incus, the very first thing you want to do is configure your server with:

incus admin init

... in order to run an interactive session of answering questions to set up your server (storage pools, networking etc). At the end of this, you can choose to output the "preseed" YAML file which you can use in future setups in order to configure non-interactively like so:

cat myPreseedFile.yaml | incus admin init --preseed

Once you have done this, you can interact with your LXD server through the REST API at the server's IP and the port you specified. If you go there in your web browser, you will be redirected to a ui path that has a blank white page, unless y ou install the incus-ui-canonical package, which will provide a nice web UI as shown below:

References

Last updated: 20th March 2024
First published: 16th March 2024