Sysadmin Containers VMs Docker LXD
Note: the instructions below say to install LXD using Snap. I personally dislike Snap, but LXD is a Canonical product and they’re doing their best to promote it as much as possible. Incus is a fork of LXD by the primary creators and maintainers and one of the first things they did was rip out Snap support, so it will eventually be installable as a proper native package.
As an example of how to use LXD in a real situation, we’ll set up my URL shortener. You’ll need a VPS with LXD installed and a (sub)domain pointed to the VPS.
Run lxc launch images:debian/12 earl followed by lxc shell earl and apt install curl. Also apt install a text editor, like vim or nano depending on what you’re comfortable with. Head to the Installation section of earl’s SourceHut page and expand the List of latest binaries. Copy the link to the binary appropriate for your platform, head back to your terminal, type curl -LO, and paste the link you copied. This will download the binary to your system. Run mv <filename> earl to rename it, chmod +x earl to make it executable, then ./earl to execute it. It will create a file called config.yaml that you need to edit before proceeding. Change the accessToken to something else and replace the listen value, 127.0.0.1, with 0.0.0.0. This exposes the application to the host system so we can reverse proxy it.
The next step is daemonising it so it runs as soon as the system boots. Edit the file located at /etc/systemd/system/earl.service and paste the following code snippet into it.