Install OpenNebula LXD node on Debian 10

You can download this article in PDF format via the link below to support us.
Download the guide in PDF formatshut down

This is another article in the OpenNebula cloud management platform series. In this article, we study how to install and use LXD, which provides a user experience similar to a virtual machine but uses Linux containers. LXD is image-based, and there are many pre-packaged OS images available for Linux distributions. In this article, we will install the OpeNebula LXD node on the Debian 10 system.

LXD nodes are supported on Debian 10 (Buster) operating system. In this installation, we use LXD provided as a distribution package (via APT), but a Snap package is also provided. In a recent guide, we discussed the installation and configuration of OpenNebula KVM nodes.

The following are the steps to set up an OpenNebula LXD node on a Debian 10 (Buster) system.

Step 1: Update Debian 10 (Buster) system

Before installing any LXD software packages, it is recommended that you update the system.

sudo apt update
sudo apt -y full-upgrade

After the upgrade, if necessary, check and restart the system:

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

Step 2: Set the server hostname and configure NTP

Log in to the LXD node server and configure the host name.

sudo hostnamectl set-hostname

Where is the actual host name of the LXD server.

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

$ sudo vim /etc/hosts onelxd01 # Set correctly

Uninstall the ntp package before installing chrony.

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

Set the correct time zone on the server:

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

Use the following command to start time synchronization:

$ 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 the OpenNebula repository to the Debian 10 system

Before adding the APT repository, please import the GPG key on Debian 10.

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

Then add the OpenNebula Community Edition repository:

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

Update the APT package index to confirm whether it works as expected:

sudo apt update

Step 4: Install OpenNebula LXD node on Debian 10

Run the following command to install the OpenNebula LXD node on Debian 10:

sudo apt update
sudo apt install opennebula-node-lxd

hit ÿ Agree to the key prompted by the installation:

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 the front end

The OpenNebula front end will use SSH to connect to the hypervisor node. You need to configure the front-end node and all hypervisor nodes to connect to each other via SSH without password authentication. This eliminates any manual intervention.

OpenNebula front-end node operation:

Log in to your front-end OpenNebula node:

$ ssh [email protected]_ip

Switch to an administrator user:

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

After installing the OpenNebula server software package on the front-end, an SSH key pair will be automatically generated for the oneadmin user, which includes:

$ 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 the /var/lib/one/.ssh/ file from the front end:

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

OpenNebula LXD node operation:

Log in to the OpenNebula LXD node to be configured:

$ ssh [email protected]

Use the following command to switch to the oneadmin user account:

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

Create an authorization key file (if it does not exist):

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

Add the copied front-end SSH public key to the file:

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

Test passwordless SSH connection from the front end

I suggest you add IP and hostname mapping in the frontend /etc/hosts file:

$ sudo vim /etc/hosts onelxd01 # Set correctly

Initiate an SSH request as the oneadmin user:

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

The SSH connection can be confirmed without password verification:

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 the LXD node to OpenNebula

The next step is to register the LXD node in the OpenNebula front end. This step can be performed in the CLI or Sunstone Web interface.

Log in to the Sunstone web interface and navigate to infrastructure -> host

Click on + Button.Install opennebula kvm node 02

select”LXD“As your host type:Install opennebula lxd node 01

Enter the hostname/IP address and click the “Create” button.Install opennebula lxd node 02

After the addition is successful, the node should appear in the OpenNebula virtual host list.Install opennebula lxd node 03

Since LXD does not require virtualization expansion, it can peacefully coexist with KVM or other HVM hypervisors in the same virtualization can use it Import virtual machine Function, if you want to manage pre-existing containers.

The next article in the link describes creating and running LXD containers on the configured nodes.

Other OpenNebula guides:

How to configure NFS file system as OpenNebula data storage

Import CentOS 8 | CentOS 7 Qcow2 image on OpenNebula

You can download this article in PDF format via the link below to support us.
Download the guide in PDF formatshut down

Related Posts