Installing Calculate in LXD

Updated 7 August 2019

LXC

The LXD container hypervisor is based on LXC, but has its own configuration and deployment tools. Use the following instructions to install Calculate Linux Container with LXD.

Installing software

To work with LXD containers, first install app-emulation/lxd:

emerge -a app-emulation/lxd

Configuring LXD

Unlike LXC configuration, the network bridge is made up by the lxd+ daemon, saving you the trouble of configuring it yourself. Lauch the /etc/init.d/lxd daemon:

/etc/init.d/lxd start

Now define basic settings:

lxd init

You will be prompted some questions. You can use the default settings. Then a virtual bridge lxdbr0+ will be created.

Adding a remote repository for the container image

Now add the remote repository, where your container image will be stored:

lxc remote add calculate https://mirror.calculate-linux.org --protocol simplestreams

To make things a bit more complicated, LXD must be configured with the lxc tool ;)

Creating a container

To view the list of the available images, run:

lxc image list calculate:

Note

Please note the colon at the end.

To install Calculate, run:

lxc init calculate:CLC/17 calculate

Where:

  • calculate:CLC/17 is the repository and the image alias;
  • calculate is a random container name.

LXD stores all data in /var/lib/lxd.

Starting the container

To start your LXD container, please run:

lxc start calculate

Add the container to autostart:

rc-update add lxd default

lxc config set calculate boot.autostart 1

To go to the container's command line shell, run:

lxc exec calculate /bin/bash

To stop the container, run:

lxc stop calculate

To remove the container, run:

lxc delete calculate