In our recent article we discussed on how you can Install and Configure OpenNebula Front-end on a Debian 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.
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 update && 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
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
curl -fsSL https://downloads.opennebula.io/repo/repo2.key|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/opennebula.gpg
Then add repository file. Confirm latest release and update accordingly.
### Debian 12 / Debian 11 ###
echo "deb https://downloads.opennebula.io/repo/6.6/Debian/11 stable opennebula" | sudo tee /etc/apt/sources.list.d/opennebula.list
### Debian 10 ###
echo "deb https://downloads.opennebula.io/repo/6.6/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
In this step we perform the installation of OpenNebula KVM Node packages on Debian 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:
$ systemctl status libvirtd
● libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-08-25 00:27:07 EAT; 11s 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
Aug 25 00:27:07 onekvm01.example.com systemd[1]: Starting Virtualization daemon...
Aug 25 00:27:07 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 username@frontendip
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
On KVM Hypervisor node
Login to KVM node being configured:
ssh username@onekvmnode
Switch to oneadmin user account:
$ sudo su - oneadmin
oneadmin@onekvm01:~$
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:
oneadmin@onefront:~$ ssh oneadmin@onekvm01
Confirm connectivity doesn’t prompt for password:
Warning: Permanently added 'onekvm01,192.168.100.11' (ECDSA) to the list of known hosts.
....
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@onekvm01:~$
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
Click on the +
button.
Choose Host type. In my case this is “KVM“.
Input the Hostname/IP address and click “Create” button.
You should see the Host added in the list.
If you click on the “Host” added more details will be available.
Step 7: Configure Bridge for VMs Networking
We will be setting up a Linux bridge and include a physical device in the bridge.
Refer to the guide below:
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.
Step 9: Add OS Images to OpenNebula
Here is a link to helpful guide: