Welcome to our guide on How to install and configure OpenNebula KVM Node on Ubuntu 20.04|18.04 & Ubuntu 16.04 LTS. Our last article was on How to Install OpenNebula Front-end on Ubuntu. Before you can proceed with this guide, you should have working OpenNebula Front-end server which can be installed from the link shared.
For CentOS 7, check OpenNebula KVM Node Installation on CentOS 7
KVM (Kernel-based Virtual Machine) is an Open Source hypervisor for OpenNebula’s Open Cloud Architecture. KVM is a complete virtualization software for Linux where each Virtual Machine interacts with its own virtualized hardware.
OpenNebula KVM Node Installation on Ubuntu 18.04 & Ubuntu 16.04- Requirements
The KVM Nodes (physical hosts) should have CPU with Intel VT or AMD’s AMD-V features, in order to support virtualization. KVM’s Preparing to use KVM guide will clarify any doubts you may have regarding if your hardware supports KVM.
Step 1: Add the OpenNebula repository
Import OpenNebula Repository Key:
wget -q -O- https://downloads.opennebula.org/repo/repo.key | sudo apt-key add -
Then add OpenNebula repository to your Ubuntu 20.04|18.04|16.04 LTS server. Please check the recent version of OpenNebula as you install. As of this writing, the recent version is 5.12.
sudo apt-get update
Add the repository to the system:
echo "deb https://downloads.opennebula.org/repo/5.12/Ubuntu/20.04 stable opennebula" | sudo tee /etc/apt/sources.list.d/opennebula.list
For Ubuntu 18.04:
echo "deb https://downloads.opennebula.org/repo/5.12/Ubuntu/18.04 stable opennebula" | sudo tee /etc/apt/sources.list.d/opennebula.list
For Ubuntu 16.04:
echo "deb https://downloads.opennebula.org/repo/5.12/Ubuntu/16.04 stable opennebula" | sudo tee /etc/apt/sources.list.d/opennebula.list
Step 2. Install OpenNebula KVM packages
Execute the following commands to install the node package and restart libvirt to use the OpenNebula provided configuration file:
sudo apt-get update sudo apt-get install opennebula-node
Accept the installation using the y key:
The following packages will be upgraded: libnss-systemd libpam-systemd libsystemd0 systemd systemd-sysv systemd-timesyncd 6 upgraded, 179 newly installed, 0 to remove and 122 not upgraded. Need to get 62.0 MB of archives. After this operation, 246 MB of additional disk space will be used. Do you want to continue? [Y/n] y
You should have these line under /etc/libvirt/libvirtd.conf for oneadmin to work well with KVM:
$ sudo vim /etc/libvirt/libvirtd.conf unix_sock_group = "oneadmin" unix_sock_rw_perms = "0777"
Always restart libvirtd when you make a change.
sudo systemctl restart libvirtd.service libvirt-bin.service
For further configuration, check the specific guide: KVM.
Step 3: Configure Passwordless SSH
OpenNebula Front-end connects to the hypervisor Hosts using SSH. You must distribute the public key of the user
oneadmin from all machines to the file
/var/lib/one/.ssh/authorized_keyson all the machines. When the package was installed in the Front-end, an SSH key was generated and the authorized_keys populated. We need to create a known_hosts file and sync it as well to the nodes. To create the
known_hosts file, we have to execute this command as user oneadmin in the Front-end with all the node names and the Front-end name as parameters:
$ sudo su - oneadmin $ ssh-keyscan <frontend> <node1> <node2> ... >> /var/lib/one/.ssh/known_hosts
Now we need to copy the directory /var/lib/one/.ssh to all the nodes. You can reset the password for the oneadmin user on all nodes.
sudo passwd oneadmin
Then on Front-end node, run
$ scp -rp /var/lib/one/.ssh <node1>:/var/lib/one/ $ scp -rp /var/lib/one/.ssh <node2>:/var/lib/one/
Test ssh from Front-end, you should not be prompted for a password:
$ ssh <node1> $ ssh <frontend>
$ ssh-keyscan 192.168.18.50 192.168.18.51 >> /var/lib/one/.ssh/known_hosts
192.168.18.50 is the IP address of Frontend Node and
192.168.18.51 is the IP Address of first KVM node.
Copy from Frontend to KVM node:
$ scp -rp /var/lib/one/.ssh 192.168.18.51:/var/lib/one/ [email protected]'s password: authorized_keys 100% 400 133.7KB/s 00:00 id_rsa 100% 1679 378.2KB/s 00:00 known_hosts 100% 1330 486.0KB/s 00:00 id_rsa.pub 100% 400 251.8KB/s 00:00
Test SSH from the Frontend:
[email protected]:~$ ssh 192.168.18.51 [email protected]:~$
Step 4: Configure Host Networking
A network connection is needed by the OpenNebula Front-end daemons to access the hosts to manage and monitor the Hosts, and to transfer the Image files. It is highly recommended to use a dedicated network for management purposes.
OpenNebula supports four different networking modes:
- Bridged. The Virtual Machine is directly attached to an existing bridge in the hypervisor. This mode can be configured to use security groups and network isolation.
- VLAN. Virtual Networks are implemented through 802.1Q VLAN tagging.
- VXLAN. Virtual Networks implements VLANs using the VXLAN protocol that relies on a UDP encapsulation and IP multicast.
- Open vSwitch. Similar to the VLAN mode but using an Open vSwitch instead of a Linux bridge.
Documentation for each is provided on the links. My setup uses Bridged networking. I have three bridges on compute hosts, for storage, a private network, and public data.
For storage configurations, visit Open Cloud Storage
Step 5: Adding a Host to OpenNebula
The final step is Adding a Host to OpenNebula. The node is being registered on the OpenNebula Front-end so that OpenNebula can launch VMs on it. This step can be done in the CLI or in Sunstone, the graphical user interface. Follow just one method, not both, as they accomplish the same.
Adding a Host through Sunstone
Open the Sunstone > Infrastructure -> Hosts. Click on the + button. Select KVM for type field.
The fill in the fqdn or IP address of the node in the Hostname field.
Go back to the hosts’ section and confirm it’s in ON state.
If the host turns to the state
err instead of
/var/log/one/oned.log Chances are it’s a problem with the SSH!
Adding a Host through the CLI
To add a node to the cloud, run this command as
oneadmin in the Front-end:
$ onehost create <node01> -i kvm -v kvm
Then check added hosts after few minutes.
$ onehost list ID NAME CLUSTER TVM ALLOCATED_CPU ALLOCATED_MEM STAT 0 192.168.18.51 default 0 0 / 200 (0%) 0K / 3.9G (0%) on
This is the end of OpenNebula KVM Node Installation on Ubuntu 20.04|18.04|16.04. In the next guide, we’ll cover Virtual configurations and Storage.