OpenNebula (Part I) – Creating a new host

Ok… so once I’ve installed OpenNebula using the rpm packages it’s time to start playing with it. I encourage you to read the following two pages from OpenNebula official documentation, it’ll help you to understand hosts and which commands are at your disposal:

The first step is adding a host (called haddock.local) to our cluster with the onehost create command. My N40L server is running kvm and openvswitch so the command will be executed as follows (please read Managing hosts for a complete list of available parameters):

su oneadmin //You'll need to run commands using the oneadmin user
onehost create haddock.local -i im_kvm -v vmm_kvm -n ovswitch

If the command was succesfull, it will return with a numeric identifier for your new host. If you want to list all the hosts in the cluster use the onehost list command:

[oneadmin@haddock ~]$ onehost list
 4 haddock.local - 0 0 / 200 (0%)   0K / 5.6G (0%) on

And if you want to get more information about a host, you can use the onehost show command using the identifier for the host (in my case 4)

[oneadmin@haddock ~]$ onehost show 4
ID : 4 
NAME : haddock.local 
IM_MAD : im_kvm
VM_MAD : vmm_kvm 
VN_MAD : ovswitch 
LAST MONITORING TIME : 11/26 20:09:59 ...

Easy!…. but in my case, it was not so easy in fact. The first time I created the host the onehost list command showed “err” in my status, so something was wrong. I’ll tell you about the problems I found and how I solved them just in case.

OpenNebula logs will help you a lot, so take a look at /var/log/one directory. I found in the oned.log file this message “Error monitoring host 0 : MONITOR FAILURE 0 Could not update remotes“. Ok, so it seems that the monitoring process couldn’t get access to my localhost. OpenNebula documentation it’s very clear about this “Before adding a host check that you can ssh to it without being prompt for a password”. OpenNebula suggests “sharing the $HOME of oneadmin accross all the servers with NFS or by manually copying the ~/.ssh directory”, but I prefer to create ssh keys so no password is asked. The passphrase is empty.

[oneadmin@haddock ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/one/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/one/.ssh/id_rsa.
Your public key has been saved in /var/lib/one/.ssh/
The key fingerprint is:
............................. oneadmin@haddock.local
The key's randomart image is:
+--[ RSA 2048]----+
| . |
| o |
| . o |

As a root set a password for your oneadmin with passwd oneadmin

Now, let’s copy the ssh public key password to our host, so ssh won’t ask oneadmin user for a password.

[oneadmin@haddock ~]$ ssh-copy-id -i /var/lib/one/.ssh/ oneadmin@haddock.local
oneadmin@haddock.local's password:
Now try logging into the machine, with "ssh 'oneadmin@haddock.local'", and check in:


to make sure we haven't added extra keys that you weren't expecting.

If you are running SELinux, you’ll need to run as root the following commands, so SELinux allows you to connect to your localhost using the authorized_keys file. SELinux is difficult and boring but try to keep it enabled… trust me it’s better.

#chcon -v --type=ssh_home_t /var/lib/one/.ssh/authorized_keys
#semanage fcontext -a -t ssh_home_t /var/lib/one/.ssh/authorized_keys

Important: Now, try to ssh your host, if no password is prompted for the oneadmin user everything’s good. Also the host key verification will succeed.

Another problem was shown in the oned.log file. OpenNebula couldn’t write some files to /var/tmp/one directory (“Command execution fail: scp -r /var/lib/one/remotes/. haddock.local:/var/tmp/one“), so I created the /var/tmp/one directory and set the right owner:

#mkdir /var/tmp/one
#chown oneadmin:oneadmin /var/tmp/one

And finally, another error, but this is just because I compiled libvirt from the source: “Authorization requires authentication but no agent is available“. The solution is adding oneadmin to the libvirt group. Please read this updated post to know how to solve it.

Wow, it was a bit tricky but maybe I did something wrong, please let me know if you were lucky. In a few days I’ll run my first virtual machine in OpenNebula. Have a good time!


Quick and easy: Installing Open Nebula 3.8 in CentOS 6.3

Hi again!
In September I tried to install OpenNebula 3.6 using source files as I couldn’t find rpm packages for CentOS but maybe I wasn’t clever enough because according to OpenNebula web page you can download packages for the latest release. Installing from source was easy (let me know if you want me to write a post about the steps I followed) but if you have rpm packages you can have OpenNebula running in five minutes. Enough chat, back to work!

  1. You’ll have to download OpenNebula rpm packages. Go to fill the form and don’t forget to select OpenNebula 3.8.X Centos 6.3 tarball under Software Component.
  2. You’ll need to enable EPEL repository on your system. If you don’t know how to do that, download the following rpm and install it:
    rpm -Uvh epel-release-6-8.noarch.rpm
  3. Updated 29/12/2012. You can skip steps 4 and 5 (I keep them only for reference). As Kolmis suggests, it’s better to use yum localinstall to install OpenNebula rpm packages so dependencies are solved:
    tar xvfz CentOS-6.3-opennebula-3.8.1.tar.gz
    cd opennebula-3.8.1
    yum --nogpgcheck localinstall opennebula-3.8.1-1.x86_64.rpm
    yum --nogpgcheck localinstall opennebula-sunstone-3.8.1-1.x86_64.rpm
  4. With root privileges download the following packages required by OpenNebula (remember, you need EPEL repository!). Note: As I installed OpenNebula 3.6 previously in my system it’s possible that I downloaded some required packages that are not listed in the following yum command, please let me know if you have any problem so I can update this post with your help.
    yum install ruby rubygems rubygem-nokogiri rubygem-json rubygem-rack rubygem-sequel rubygem-sinatra rubygem-sqlite3-ruby rubygem-thin rubygem-uuidtools xmlrpc-c-c++ xmlrpc-c-client++
  5. Untar the OpenNebula file and install the packages (I’ve only installed openebula and opennebula-sunstone packages).
    tar xvfz CentOS-6.3-opennebula-3.8.1.tar.gz
    cd opennebula-3.8.1
    rpm -Uvh opennebula-3.8.1-1.x86_64.rpm
    rpm -Uvh opennebula-sunstone-3.8.1-1.x86_64.rpm
  6. Ok. Everything is ready. OpenNebula created the oneadmin user (home directory: /var/lib/one) and installed /etc/init.d scripts (thanks OpenNebula guys!) so it’s easy to start and stop the daemons. Let’s start the OpenNebula service as root
    # service opennebula start
    Starting OpenNebula daemon: [ OK ]

    And now let’s check if opennebula is ready to have fun. Warning: If you run the following command as root, the following message will be shown “ONE_AUTH file not present” (there’s no authentication file with OpenNebula credentiales in your home directory), so please use your new oneadmin account to manage OpenNebula.

    # su oneadmin
    [oneadmin@server ~]$ onevm list

    If you see ID, USER, GROUP… after running the onevm list command, everything looks fine. In a few days I’ll post about OpenNebula configuration and some interesting commands. Enjoy!