Install OpenNebula KVM node on Debian 10 (Buster)

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

In our recent article, we discussed how to install and configure the OpenNebula frontend on Debian 10. In this guide, we delved into the installation of OpenNebula KVM Node that will run the VM. You need to use the minimum node installation of a hypervisor to complete the deployment and use of OpenNebula to manage your virtualized infrastructure.

Step 1: Update the Debian system

Make sure we are developing the latest version of the operating system.

sudo apt update
sudo apt -y full-upgrade

Check whether a restart is required. If needed, the command will perform a reboot.

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

Step 2: Set the hostname and configure NTP

Log in to the server and set the correct hostname.

sudo hostnamectl set-hostname is replaced with the correct host name.

Add the IP and hostname to /etc/hosts:

$ sudo vim /etc/hosts onekvm01 # Set correctly

Uninstall the ntp package and install chrony.

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

Then make sure that the correct time zone 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
^-           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

We will use the community edition repository for this installation.

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

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

Then add the repository file:

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

Update the 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 the OpenNebula KVM Node package on the Debian 10 system. KVM is a complete virtualization system for Linux. It provides complete virtualization, where each virtual machine interacts with its own virtualization hardware.

You will need an x86 machine that runs the latest Linux kernel on an Intel processor with VT (Virtualization Technology) extension or an AMD processor with SVM extension (also known as AMD-V).

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

If something shows up, you have Ventricular velocity.

In your terminal, execute the following command to install the KVM node software package:

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, and then restart libvirt to obtain the configuration file provided by OpenNebula:

sudo systemctl restart libvirtd

Make sure to set it to start when the system boots:

$ 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 the status of libvirtd service:

$ 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)
 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 systemd[1]: Starting Virtualization daemon...
Mar 19 11:25:13 systemd[1]: Started Virtualization daemon.

Step 5: Configure passwordless SSH

The OpenNebula front end will use SSH to connect to the hypervisor node. The following are the types of connections being established:

  • From front to front,
  • From the front end to the hypervisor host,
  • From the front end to the hypervisor host, and there is another connection with another host (for migration operations),
  • Another connection from the front-end to the hypervisor host and back-end to the front-end (used to send back data).

You need to ensure that the front-end and all hypervisor nodes can connect to each other via SSH without manual intervention.

What to do on the front end

Log in to your front end:

$ ssh [email protected]

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. The key pair 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/

On the KVM Hypervisor node

Log in to the KVM node being configured:

$ ssh [email protected]

Switch to an administrator user account:

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

Touch whether the authorization key file exists:

$ 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 onekvm01 # Set correctly

Initiate an SSH request as the oneadmin user:

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

Confirm connection without prompting for password:

Warning: Permanently added 'onekvm01,' (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 KVM host to OpenNebula

In this step, we will register the KVM node that has been installed in the OpenNebula front-end. This step can be done in the CLI or Sunstone Web graphical interface.

In this step, we will use the Sunstone web interface.Log in to the web console and navigate to infrastructure -> hostInstall opennebula kvm node 01

Click on + Button.Install opennebula kvm node 02

Select the host type. In my case, this is “virtual machine“.Install opennebula kvm node 03

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

You should see the host added to the list.Install opennebula kvm node 05

If you click “host“Added more details.Install opennebula kvm node 06

Step 7: Create Linux Bridge for VMs network

We will build a Linux bridge and include a physical device in the bridge.opennebula kvm network 02

Please refer to the following guide:

Create Linux Bridge on VLAN interface in Debian

Now that the KVM node has been added, we will introduce the configuration steps of storage and network, and then we can configure the VM on the OpenNebula platform.

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

Related Posts