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

In our recent article we discussed on how you can Install and Configure OpenNebula Front-end on a Debian 10 system. In this guide we dive deep into the installation of OpenNebula KVM Node where the VMs are going to run. The hypervisor minimal node installation is needed in order to finish deployment and usage of OpenNebula to mange your Virtualization Infrastructure.

opennebula hld

Step 1: Update Debian System

Let’s make sure we’re working on the latest release of the Operating System.

sudo apt update
sudo apt -y full-upgrade

Check if the reboot is required. The command will perform a reboot if needed.

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

Step 2: Set Hostname and Configure NTP

Login to the server and set correct hostname.

sudo hostnamectl set-hostname onekvm01.example.com

Where onekvm01.example.com is replaced with the correct hostname.

Add IP and hostname to /etc/hosts:

$ sudo vim /etc/hosts
192.168.100.11 onekvm01.example.com onekvm01 # Set correctly

Uninstall ntp package and install chrony.

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

Then ensure the correct timezone is set:

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

Show time synchronization status:

$ 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 10 system

We’ll be using the Community edition repositories for this installation.

Import GPG key by running the command below on the terminal:

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 repository file:

echo "deb https://downloads.opennebula.io/repo/5.12/Debian/10 stable opennebula" | sudo tee /etc/apt/sources.list.d/opennebula.list

Update APT package index after adding the repository:

sudo apt update

Step 4: Install OpenNebula KVM Node on Debian 10

In this step we perform the installation of OpenNebula KVM Node packages on Debian 10 system. KVM is a complete virtualization system for Linux. It offers full virtualization, where each Virtual Machine interacts with its own virtualized hardware.

You will need an x86 machine running a recent Linux kernel on an Intel processor with VT (virtualization technology) extensions, or an AMD processor with SVM extensions (also called AMD-V).

$ egrep '^flags.*(vmx|svm)' /proc/cpuinfo

If something shows up, you have VT.

In your terminal execute the following commands to install the KVM node packages:

sudo apt update
sudo apt install opennebula-node

Accept the next installation prompt:

...
0 upgraded, 303 newly installed, 0 to remove and 11 not upgraded.
Need to get 152 MB of archives.
After this operation, 689 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Wait for the package installation step to complete then restart libvirt to se the OpenNebula-provided configuration file:

sudo systemctl restart libvirtd

Make sure it is set to start on system boot:

$ sudo systemctl enable libvirtd
Synchronizing state of libvirtd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable libvirtd

Check libvirtd service status:

$ sudo systemctl status  libvirtd
● libvirtd.service - Virtualization daemon
   Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-03-19 11:25:13 EAT; 14s ago
     Docs: man:libvirtd(8)
           https://libvirt.org
 Main PID: 8240 (libvirtd)
    Tasks: 17 (limit: 32768)
   Memory: 16.0M
   CGroup: /system.slice/libvirtd.service
           └─8240 /usr/sbin/libvirtd

Mar 19 11:25:13 onekvm01.example.com systemd[1]: Starting Virtualization daemon...
Mar 19 11:25:13 onekvm01.example.com systemd[1]: Started Virtualization daemon.

Step 5: Configure Passwordless SSH

The OpenNebula Front-end will connect to the hypervisor Nodes using SSH. Below are the connection types being established:

  • from Front-end to Front-end,
  • from Front-end to hypervisor Host,
  • from Front-end to hypervisor Host with another connection within to another Host (for migration operations),
  • from Front-end to hypervisor Host with another connection within back to Front-end (for data copy back).

You’ll need to ensure that Front-end and all Hypervisor Nodes can connect to each other over SSH without manual intervention.

What to do on Frontend

Login to your Frontend:

$ ssh [email protected]

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/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

On KVM Hypervisor node

Login to KVM node being configured:

$ ssh [email protected]

Switch to oneadmin user account:

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

Touch the authorized keys file exists:

$ 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 Frontend

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

$ sudo vim /etc/hosts
192.168.100.11 onekvm01.example.com onekvm01 # Set correctly

As oneadmin user initiate an SSH request:

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

Confirm connectivity doesn’t prompt for password:

Warning: Permanently added 'onekvm01,192.168.100.11' (ECDSA) to the list of known hosts.
Linux onekvm01.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.
[email protected]:~$

Step 6: Add KVM Host to OpenNebula

In this step we will do a registration of the KVM node we have installed in the OpenNebula Front-end. This step can be done in the CLI or in Sunstone web graphical interface.

We will use the Sunstone web interface in this step. Login to the Web console and navigate to Infrastructure -> Hosts

install opennebula kvm node 01

Click on the + button.

install opennebula kvm node 02

Choose Host type. In my case this is “KVM“.

install opennebula kvm node 03

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

install opennebula kvm node 04

You should see the Host added in the list.

install opennebula kvm node 05

If you click on the “Host” added more details will be available.

install opennebula kvm node 06

Step 7: Configure Bridge for VMs Networking

We will be setting up a Linux bridge and include a physical device in the bridge.

opennebula kvm network 02

Refer to the guide below:

Create and Use Bridged Networks in OpenNebula VMs

Now that KVM node has been added, we’ll cover configuration steps for Storage and Networking before VMs can be provisioned on OpenNebula platform.

Step 8: Configure OpenNebula Datastores

Datastores are used to store OS images and Virtual Machines data. We have a separate guide on the configurations required.

How To Configure NFS Filesystem as OpenNebula Datastores

Step 9: Add OS Images to OpenNebula

Here is a link to helpful guide:

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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here