OpenNebula

How to set up and utilize OpenNebula to build a powerful open source cloud.


Introduction

OpenNebula is an Open Source Cloud Management Platform that allows you to build Private Clouds with ease.

OpenNebula is an alternative to OpenStack and covers the majority of functionality available by OpenStack.  OpenNebula is a mature platform and describes itself as "Enterprise Ready" with a wide user-base and proven stability/scale-ability.


Preparation

This guide shows how to deploy and install OpenNebula in a one-node configuration.  Additional hosts can easily be prepared and added in a future stage by following the "Installing OpenNebula KVM Node" section in the bottom of this article. 

While OpenNebula is very lightweight and can be used on a t1.small ($.07/hr) device with no issues, we will use a c1.small server ($.40/hr) with Ubuntu 16.04 in this guide.  The single machine will host OpenNebula’s Management Interface as well as the KVM Hypervisor to run Virtual Machines in the same node. 

When deploying your server you should select a /29 IPv4 subnet (4 Usable IP’s), which will be used to assign VM’s.  This saves you the trouble of requesting additional IP’s post-deployment using Packet's Elastic IPv4 feature.


Selecting a subnet size 

47000BPWXZJRJXRZMKXR0-1539925331093.png


Let’s go ahead and deploy this node:

47002MHWXXPCZDQXGTWZ0-1539925331562.png


It should take about 10 minutes for your server to deploy and install. Once the server is provisioned you can SSH into the device by using authorized SSH keys.


Install OpenNebula

First, add OpenNebula to the apt-get repository - 

# wget -q -O- https://downloads.opennebula.org/repo/repo.key | apt-key add -

OK

# apt-get install apt-transport-https


# echo "deb https://downloads.opennebula.org/repo/5.4/Ubuntu/16.04 stable opennebula" > /etc/apt/sources.list.d/opennebula.list


Then install OpenNebula and dependencies (OpenNebula Management Interface)

# apt-get update

# apt-get install -y opennebula opennebula-sunstone opennebula-gate opennebula-flow


# /usr/share/one/install_gems

PRESS [ENTER] To continue


Utilize MySQL Database instead of SQLite (optional but recommended for production workloads).

# apt-get install -y mysql-server

While not mandatory, it is highly recommended that you set a password for the MySQL administrative "root" user.


After MySQL is installed you need to add privileges to oneadmin.

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. [...]

mysql> GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin' IDENTIFIED BY 'THEPASSWORD';

Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;

mysql> exit


The final step in enabling MySQL includes modifying the oned.conf (ONE Daemon Configuration) file. 

# nano /etc/one/oned.conf

Navigate down to DB Section, and comment out DB = [ backend = “sqlite” ] 

Uncomment the MySQL Section and enter the password you set via GRANT ALL PRIVILEGES.


Starting OpenNebula

# systemctl start opennebula
# systemctl start opennebula-sunstone


Test if OpenNebula is running properly:

# oneuser show
USER 0 INFORMATION
ID              : 0
NAME            : oneadmin
GROUP           : oneadmin
PASSWORD        : 3bc15c8aae3e4124dd409035f32ea2fd6835efc9
AUTH_DRIVER     : core
ENABLED         : Yes

The above text means that OpenNebula is operating normally, and no additional changes need to be made.


Log into OpenNebula Sunstone Interface

This will output your OpenNebula Username:Password which can be used to Manage your deployment.

# cat /var/lib/one/.one/one_auth

oneadmin:Vu29Sk39zMn9


Now navigate to http://147.75.x.x:9869 to find the user interface. 


Install OpenNebula KVM Node

You can repeat these steps in additional nodes to add additional nodes to your cluster.

# sudo apt-get install -y opennebula-node

Country of origin for the keyboard: 29 (US = 29)

# sudo service libvirt-bin restart 


Passwordless SSH 

# sudo su oneadmin

$ cd ~/.ssh

We need to ensure that the front-end can login to each node without any input, when adding additional nodes you need to sync the front-end .ssh folder with each node. 

$ cp id_rsa.pub authorized_keys                                                                                                                         This step should log you into the same user account using SSH without any input other than adding the host to your known_hosts file.

$ ssh <hostname>

Are you sure you want to continue connecting (yes/no)? Yes 
Welcome to Ubuntu 16.04.3 LTS 

$ exit

Connection to <hostname> closed.

$ exit

Now we are back to our root account.


Create a Network Bridge

You can follow this guide to create a network bridge for KVM on Bonded Networks with Packet.net.

https://support.packet.com/kb/articles/kvm-qemu-bridging-on-a-bonded-network


Adding KVM Node to Sunstone

Navigate to Infrastructure -> Hosts -> +

47003XGGMSDMWMDWXHTX0-1539925332015.png


Type in your hostname:

46999XGNXGYXCSSMWYCB0-1539925330872.png


Press refresh after a few seconds pass.

47014YCRXSMQMRSKTMQK0-1539925335847.png


Adding a Network Subnet

Navigate to Network -> Virtual Networks -> + 

47001JAACBKDBCMDYAYG0-1539925331360.png


Type your bridge name in Conf Tab.

47004MHAMTYKDCZTRCRC0-1539925332210.png


Add your /29 subnet to Addresses Range:

47005WGTJSXMWGZWZPSS0-1539925332819.png


Setup the context with the correct variables:

47006XNXYYGJKNDZRHCB0-1539925332534.png


Adding Virtual Machine Images

Navigate to Storage -> Apps -> Search “KVM”

These are the images found in the default OpenNebula Marketplace.

47008GJCGCSQTMZWBCAT0-1539925333477.png


Let’s select Ubuntu 16.04 and add it to our Image Datastore.

47007PDRJAKBQHQTTKSS0-1539925333178.png


Select the default Datastore and click Download:

47010XSXBZNTXQNADDMA0-1539925333824.png


You can navigate to Storage -> Images to see the new entry. It will be in status: LOCKED for the first minute until the server completes the download and then it will become status: READY.

47009KDNACRCCQQJKBMZ0-1539925333646.png


Let’s configure the template that came with the image, in order to add our own keys - or modify the default config.

          Templates -> VMs -> Ubuntu 16.04 KVM -> Update

47011PTZKTYSHSHJYSJT0-1539925334128.png


We can now deploy a VM using this template,

          Navigate to Instances -> VMs -> +

47015BNQKDMWSADGKZXC0-1539925334569.png


Voila, our VM is now running after a minute or two of initialization.

47012YGJPAGMKPGDBSAK0-1539925334754.png


We can access the VM Console by using VNC.

47013KGZDTCMAZHGGSAQ0-1539925335027.png


That’s it.

Time to build your own cloud with OpenNebula!



Helpful Resources

To enhance your OpenNebula deployment, you can check for partner integrations via the OpenNebula Technology Partner Ecosystem.

          For example, you can use an open source platform called VirtEngine to automate application deployments in OpenNebula, as well as offer OpenNebula Virtual Machines to customers via a UI that integrates with billing.