By Hitesh Jethva, Alibaba Cloud Community Blog author.
OpenNebula is a free, open source, simple yet powerful and flexible cloud computing platform for the management of virtualized data centers. It is easy to use and combines existing virtualization technologies with advanced features for multi-tenancy and elasticity.
In this tutorial, we will learn how to install and configure OpenNebula on an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 18.04 server.
Create a new ECS instance and connect to your instance as the root user.
Once you are logged into your Ubuntu 18.04 instance, run the following command to update your base system with the latest available packages.
apt-get update -y
First, you will need to install MariaDB database server to your OpenNebula front-end instance. You can install it with the following command:
apt-get install mariadb-server -y
After installing MariaDB, you will need to secure it first. You can secure it by running the following command:
mysql_secure_installation
Answer all the questions as shown below:
Enter current password for root (enter for none):
Set root password? [Y/n]: N
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y
Once the MariaDB server is secured, log in to MariaDB shell with the following command:
mysql -u root -p
Enter your root password, then create a database and user for OpenNebula with the following command:
MariaDB [(none)]> CREATE DATABASE opennebuladb;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON opennebuladb.* TO 'openadmin' IDENTIFIED BY 'password';
Next, flush the privileges and exit from the MariaDB shell with the following command:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> QUIT;
Next, restart MariaDB service with the following command:
systemctl restart mariadb
Next, check the status of MariaDB service with the following command:
systemctl status mariadb
By default, OpenNebula is not available in the Ubuntu 18.04 default repository. So, you will need to add OpenNebula repository to your OpenNebula front-end instance.
First, download and add the GPG key with the following command:
wget -q -O- https://downloads.opennebula.org/repo/repo.key | apt-key add -
Next, add the repository with the following command:
echo "deb https://downloads.opennebula.org/repo/5.6/Ubuntu/18.04 stable opennebula" | tee /etc/apt/sources.list.d/opennebula.list
Next, update the repository and install OpenNebula with the following command:
apt-get update -y
apt-get install opennebula opennebula-sunstone opennebula-gate opennebula-flow -y
After installing OpenNebula, you will also need to install Ruby libraries to your instance. You can install them by running the following command:
/usr/share/one/install_gems
Next, you will need to open /etc/one/oned.conf file and defined database credentials in the file.
nano /etc/one/oned.conf
Make the following changes:
LISTEN_ADDRESS = "0.0.0.0"
#DB = [ BACKEND = "sqlite" ]
# Sample configuration for MySQL
DB = [ BACKEND = "mysql",
SERVER = "localhost",
PORT = 0,
USER = "openadmin",
PASSWD = "password",
DB_NAME = "opennebuladb",
CONNECTIONS = 50 ]
Save and close the file. Then, you will need to define OpenNebula authentication credential in one_auth file. You can do it with the following command:
nano /var/lib/one/.one/one_auth
Make the following changes as per your need:
oneadmin:admin@123
Save and close the file. When you are finished.
Finally, start OpenNebula service and enable it to start on boot with the following command:
systemctl start opennebula
systemctl enable opennebula
systemctl start opennebula-sunstone
systemctl enable opennebula-sunstone
You can now check the status of OpenNebula with the following command:
systemctl status opennebula
And
systemctl status opennebula-sunstone
First, you will need to verify the OpenNebula installation on OpenNebula front-end instance.
You can do it with the following command:
su - oneadmin -c "oneuser show"
Now, open your web browser and type the URL http://192.18.0.102:9869
. You will be redirected to the following page:
Provide your administrator username and password which you have define in one_auth file and click on the Login button. You should see the OpenNebula dashboard in the following page:
KVM is an open source hypervisor for OpenNebula's Open Cloud Architecture. By default, OpenNebula KVM package is not available in the Ubuntu 18.04 repository. So, you will need to add OpenNebula repository to your OpenNebula KVM instance.
First, download and add the GPG key with the following command:
wget -q -O- https://downloads.opennebula.org/repo/repo.key | apt-key add -
Next, add the repository with the following command:
echo "deb https://downloads.opennebula.org/repo/5.6/Ubuntu/18.04 stable opennebula" | tee /etc/apt/sources.list.d/opennebula.list
Next, update the repository and install OpenNebula KVM package with the following command:
apt-get install opennebula-node -y
Next, you will need to edit /etc/libvirt/libvirtd.conf for OpenNebula to work well with KVM.
nano /etc/libvirt/libvirtd.conf
Make the following changes:
unix_sock_group = "oneadmin"
unix_sock_rw_perms = "0777"
Save and close the file. Then, restart libvirtd service with the following command:
systemctl restart libvirtd
systemctl restart libvirt-bin
OpenNebula Front-end connects to the OpenNebula KVM node using SSH. So, you will need to configure passwordless ssh authentication between them. You can do this by distributing the public key of the user oneadmin from both machines to the file /var/lib/one/.ssh/authorized_keys.
First, create the known_hosts file with the following command:
ssh-keyscan 192.168.0.102 >> /var/lib/one/.ssh/known_hosts
ssh-keyscan 192.168.0.249 >> /var/lib/one/.ssh/known_hosts
Next, copy /var/lib/one/.ssh directory to OpenNebula KVM node with the following command:
scp -rp /var/lib/one/.ssh root@192.168.0.249:/var/lib/one/
Next, test ssh connection from Front-end, you should not be prompted for a password:
ssh 192.168.0.249
Next, you will need to add KVM host to OpenNebula front-end so that OpenNebula can launch VMs on it.
On the OpenNebula web interface, open Infrastructure >> Hosts and Click on the + button. You should see the following page:
Select KVM for type field and IP address of KVM node. Then, click on the Create button. You should see the following page:
Now, click on the Hosts. You should see the detail information of KVM node in the following page:
Congratulations! You have successfully installed and configured OpenNebula on an ECS Ubuntu18.04 server.
How to Setup RackTables Data Center Management Tool on Ubuntu 18.04
39 posts | 4 followers
FollowHiteshjethva - October 31, 2019
Hiteshjethva - March 2, 2020
Hiteshjethva - January 8, 2020
Hiteshjethva - March 2, 2020
Hiteshjethva - January 8, 2020
Hiteshjethva - October 31, 2019
39 posts | 4 followers
FollowAlibaba Cloud (in partnership with Whale Cloud) helps telcos build an all-in-one telecommunication and digital lifestyle platform based on DingTalk.
Learn MoreElastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreAn elastic and horizontally scalable high-performance computing service providing the same computing performance as traditional physical servers including physical isolation.
Learn MoreBuild superapps and corresponding ecosystems on a full-stack platform
Learn MoreMore Posts by Hiteshjethva
5491783352582057 March 4, 2020 at 8:28 pm
Hi, Great Reading ! Is there any way to deploy VMs with public IPs from sunstone. Regards.