Saturday, December 28, 2024
Google search engine
HomeGuest BlogsOpenNebula LXD Node Installation on Debian 11|10

OpenNebula LXD Node Installation on Debian 11|10

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 system.

LXD nodes are supported on Debian 11/10 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 11|10 system.

Step 1: Update Debian 11/10 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 onelxd01.example.com

Where onelxd01.example.com is the actual LXD server hostname.

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

$ sudo vim /etc/hosts
192.168.100.12 onelxd01.example.com 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
===============================================================================
^- time.cloudflare.com           3   6    35    13    -49ms[  -49ms] +/-  167ms
^- ntp1.icolo.io                 2   6    17    14   +655us[ +655us] +/-  109ms
^* ntp0.icolo.io                 2   6    17    16   +251us[ +116ms] +/-  109ms
^+ time.cloudflare.com           3   6    33    13    -49ms[  -49ms] +/-  167ms

Step 3: Add OpenNebula Repositories to Debian 11|10

Import GPG keys on Debian before adding APT repository.

sudo apt update
sudo apt install wget gnupg2 -y
wget -q -O- https://downloads.opennebula.io/repo/repo.key | sudo apt-key add -

Then add OpenNebula community edition repositories:

echo "deb https://downloads.opennebula.io/repo/6.1/Debian/10 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 11|10

Run the command below to install OpenNebula LXD Node on Debian 11/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 username@frontend_ip

Switch to oneadmin user:

$ sudo su - oneadmin
oneadmin@onefront:~$

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/id_rsa.pub
/var/lib/one/.ssh/id_rsa.pub: OpenSSH RSA public key

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

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

OpenNebula LXD node actions:

Login to OpenNebula LXD node to be configured:

$ ssh username@onelxd01

Switch to oneadmin user account with the commands below:

$ sudo su - oneadmin
oneadmin@onelxd01:~$

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
192.168.100.12 onelxd01.example.com onelxd01 # Set correctly

As oneadmin user initiate an SSH request:

oneadmin@onefront:~$ ssh oneadmin@onelxd01

Confirm SSH connectivity without password authentication:

Warning: Permanently added 'onelxd01,192.168.100.12' (ECDSA) to the list of known hosts.
Linux onelxd01.example.com 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.
oneadmin@onelxd01:~$

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:

RELATED ARTICLES

Most Popular

Recent Comments