You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

This is yet another article on OpenNebula cloud management platform series. In this post we look at how you can install and use LXD which offers a user experience similar to virtual machines but using Linux containers instead. LXD is image based and there are lots of pre-packaged OS images of Linux distributions available for use. In this article we will be doing the installation of an OpeNebula LXD Node on Debian 10 system.

LXD nodes are supported on Debian 10 (Buster) operating system. In this installation we are using LXD shipped as a distribution package (via APT), but Snap packages are also available. In a recent guide we discussed installation and configuration of OpenNebula KVM Node.

Below are the steps you’ll follow to setup OpenNebula LXD Node on Debian 10 (Buster) system.

Step 1: Update Debian 10 (Buster) System

Before making any LXD package installation we recommend you update the system.

sudo apt update
sudo apt -y full-upgrade

Check and reboot the system if required after the upgrade:

[ -f /var/run/reboot-required ] && sudo reboot -f

Step 2: Set Server hostname and Configure NTP

Login to LXD node server and configure the hostname.

sudo hostnamectl set-hostname

Where is the actual LXD server hostname.

Consider adding the Server’s IP and hostname to /etc/hosts:

$ sudo vim /etc/hosts onelxd01 # Set correctly

Uninstall ntp package before installing chrony.

sudo apt remove ntp
sudo apt install chrony -y
sudo systemctl restart chrony
sudo systemctl enable chrony

Set correct timezone on the server:

sudo timedatectl set-timezone Africa/Nairobi
sudo timedatectl set-ntp yes

Initiate time synchronization using the following command:

$ sudo chronyc sources
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
^-           3   6    35    13    -49ms[  -49ms] +/-  167ms
^-                 2   6    17    14   +655us[ +655us] +/-  109ms
^*                 2   6    17    16   +251us[ +116ms] +/-  109ms
^+           3   6    33    13    -49ms[  -49ms] +/-  167ms

Step 3: Add OpenNebula Repositories to Debian 10 system

Import GPG keys on Debian 10 before adding APT repository.

sudo apt update
sudo apt install wget gnupg2 -y
wget -q -O- | sudo apt-key add -

Then add OpenNebula community edition repositories:

echo "deb stable opennebula" | sudo tee /etc/apt/sources.list.d/opennebula.list

Update APT package index to confirm if working as expected:

sudo apt update

Step 4: Install OpenNebula LXD Node on Debian 10

Run the command below to install OpenNebula LXD Node on Debian 10:

sudo apt update
sudo apt install opennebula-node-lxd

Hit the y key to agree to the installation prompt:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  kpartx liblzo2-2 libvncserver1 snapd squashfs-tools xfsprogs
Suggested packages:
  rbd-nbd zenity | kdialog xfsdump acl attr quota
The following NEW packages will be installed:
  kpartx liblzo2-2 libvncserver1 opennebula-node-lxd snapd squashfs-tools xfsprogs
0 upgraded, 7 newly installed, 0 to remove and 23 not upgraded.
Need to get 15.7 MB of archives.
After this operation, 65.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Step 5: Configure Passwordless SSH on Front-end

The OpenNebula Front-end will connect to the hypervisor Nodes using SSH. You’ll need to configure Front-end and all Hypervisor Nodes to connect to each other over SSH without password authentication. This eliminates any manual intervention.

OpenNebula front-end node actions:

Login to your Front-end OpenNebula node:

$ ssh [email protected]_ip

Switch to oneadmin user:

$ sudo su - oneadmin
[email protected]:~$

When OpenNebula server package is installed on the Front-end, a SSH key pair is automatically generated for the oneadmin user into:

$ file /var/lib/one/.ssh/id_rsa
/var/lib/one/.ssh/id_rsa: OpenSSH private key
$ file /var/lib/one/.ssh/
/var/lib/one/.ssh/ OpenSSH RSA public key

Copy the contents of /var/lib/one/.ssh/ file from frontend:

$ cat /var/lib/one/.ssh/

OpenNebula LXD node actions:

Login to OpenNebula LXD node to be configured:

$ ssh [email protected]

Switch to oneadmin user account with the commands below:

$ sudo su - oneadmin
[email protected]:~$

Create the authorized keys file if doesn’t exist:

$ touch /var/lib/one/.ssh/authorized_keys

Add the copied Frontend SSH public key to file:

$ vim /var/lib/one/.ssh/authorized_keys

Test Passwordless SSH connectivity from Front-end

I recommend you add IP and hostname mapping in the Frontend /etc/hosts file:

$ sudo vim /etc/hosts onelxd01 # Set correctly

As oneadmin user initiate an SSH request:

[email protected]:~$ ssh [email protected]

Confirm SSH connectivity without password authentication:

Warning: Permanently added 'onelxd01,' (ECDSA) to the list of known hosts.
Linux 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[email protected]:~$

Step 6: Add LXD Node to OpenNebula

The next step is registration of the LXD node in the OpenNebula Front-end. This step can be performed in the CLI or Sunstone web interface.

Login to Sunstone web interface and navigate to Infrastructure -> Hosts

install opennebula kvm node 01

Click on the + button.

install opennebula kvm node 02

Choose “LXD” as your host type:

install opennebula lxd node 01

Input the Hostname/IP address and click “Create” button.

install opennebula lxd node 02

On successful addition the node should appear in the list of OpenNebula virtualization hosts.

install opennebula lxd node 03

Since LXD doesn’t require virtualization extensions, it can peacefully coexist alongside KVM or other HVM hypervisor in the same virtualization node. You can use the import VM functionality if you want to manage pre-existing containers.

Next article in the link covers creating and running LXD containers on the nodes configured.

Other OpenNebula guides:

How To Configure NFS Filesystem as OpenNebula Datastores

Import CentOS 8 | CentOS 7 Qcow2 Images on OpenNebula

As an appreciation for the content we put out,
we would be thrilled if you support us!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here