List installed packages on CentOS

The command to list installed packages on CentOS is:

yum list installed  

The result will be something like this:

Installed Packages  

To search for a specific package the easiest way is:

yum list installed | grep packageName  

Installing Build Essentials on CentOS 7 and Ubuntu 14.03

Installing build essentials on Ubuntu
apt-get install -y build-essential  

Which will install the following packages:

  • The following extra packages will be installed:
    • binutils cpp cpp-4.8 dpkg-dev fakeroot g++ g++-4.8 gcc gcc-4.8
    • libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
    • libasan0 libatomic1 libc-dev-bin libc6-dev libcloog-isl4 libdpkg-perl
    • libfakeroot libfile-fcntllock-perl libgcc-4.8-dev libgmp10 libgomp1 libisl10
    • libitm1 libmpc3 libmpfr4 libquadmath0 libstdc++-4.8-dev libtimedate-perl
    • libtsan0 linux-libc-dev make manpages manpages-dev patch xz-utils
  • Suggested packages:
    • binutils-doc cpp-doc gcc-4.8-locales debian-keyring g++-multilib
    • g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg gcc-multilib autoconf
    • automake1.9 libtool flex bison gdb gcc-doc gcc-4.8-multilib libgcc1-dbg
    • libgomp1-dbg libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg
    • libquadmath0-dbg glibc-doc libstdc++-4.8-doc make-doc man-browser ed
    • diffutils-doc
  • The following NEW packages will be installed:
    • binutils build-essential cpp cpp-4.8 dpkg-dev fakeroot g++ g++-4.8 gcc
    • gcc-4.8 libalgorithm-diff-perl libalgorithm-diff-xs-perl
    • libalgorithm-merge-perl libasan0 libatomic1 libc-dev-bin libc6-dev
    • libcloog-isl4 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-4.8-dev
    • libgmp10 libgomp1 libisl10 libitm1 libmpc3 libmpfr4 libquadmath0
    • libstdc++-4.8-dev libtimedate-perl libtsan0 linux-libc-dev make manpages
    • manpages-dev patch xz-utils
Installing build essentials on CentOS
yum groupinstall "Development Tools"  
  • Installing for group install "Development Tools":
    • autoconf
    • automake
    • bison
    • byacc
    • cscope
    • ctags
    • diffstat
    • doxygen
    • elfutils
    • flex
    • gcc
    • gcc-c++
    • gcc-gfortran
    • gettext
    • git
    • indent
    • intltool
    • libtool
    • make
    • patch
    • patchutils
    • rcs
    • redhat-rpm-config
    • rpm-build
    • rpm-sign
    • subversion
    • swig
    • systemtap
  • Installing for dependencies:
    • apr
    • apr-util
    • avahi-libs
    • boost-system
    • boost-thread
    • bzip2
    • cpp
    • dwz
    • dyninst
    • emacs-filesystem
    • fipscheck
    • fipscheck-lib
    • gdb
    • gettext-common-devel
    • gettext-devel
    • gettext-libs
    • glibc-devel
    • glibc-headers
    • gnutls
    • kernel-devel
    • kernel-headers
    • libdwarf
    • libedit
    • libgfortran
    • libgnome-keyring
    • libmodman
    • libmpc
    • libproxy
    • libquadmath
    • libquadmath-devel
    • libstdc++-devel
    • m4
    • mokutil
    • mpfr
    • neon
    • nettle
    • openssh
    • openssh-clients
    • pakchois
    • perl
    • perl-Carp
    • perl-Data-Dumper
    • perl-Encode
    • perl-Error
    • perl-Exporter
    • perl-File-Path
    • perl-File-Temp
    • perl-Filter
    • perl-Getopt-Long
    • perl-Git
    • perl-HTTP-Tiny
    • perl-PathTools
    • perl-Pod-Escapes
    • perl-Pod-Perldoc
    • perl-Pod-Simple
    • perl-Pod-Usage
    • perl-Scalar-List-Utils
    • perl-Socket
    • perl-Storable
    • perl-TermReadKey
    • perl-Test-Harness
    • perl-Text-ParseWords
    • perl-Thread-Queue
    • perl-Time-HiRes
    • perl-Time-Local
    • perl-XML-Parser
    • perl-constant
    • perl-libs
    • perl-macros
    • perl-parent
    • perl-podlators
    • perl-srpm-macros
    • perl-threads
    • perl-threads-shared
    • rsync
    • subversion-libs
    • systemtap-client
    • systemtap-devel
    • systemtap-runtime
    • trousers
    • unzip
    • zip
    • base

The minimal build essentials installation on CentOS:

yum install -y gcc g++ kernel-devel  

Installing MySQL on CentOS 7

In CentOS 7 MySQL has been officially deprecated and the database of choice is MariaDB

What's MariaDB?

MariaDB is a fork of MySQL created by the lead developers of MySQL when Oracle acquired Sun.
A detailed history about MariaDB can be found here
As far as feature comparison there is a good article on MariaDB show casing the technical differences.

Installing MySQL

First, add the community MySQL repo to CentOS:

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm  

Second, install MySQL:

yum install -y mysql-server  

Finally, enable start on boot

chkconfig mysqld on  

Running OpenNebula Sunstone

To get open nebula up and running on my machine I had to gather information from a few different places since none of the instructions of each single source worked flawlessly.

The steps I took the first time:
Followed the instructions from the official guide published by OpenNebula.org
I’ve blogged about that process here

I’ve got through the set up part but when I tried to run SunStone it would not authenticate the user, thus failing to launch the tool.

I started looking for solutions online and I came up with these two tutorials:

I’ve tried them but they didn’t work by themselves, something was always missing.

In the end, after all tries and fails my system was a mess, I had to modify so many places I didn’t even remember what was happening.

I then decided to take a step back and analyze the problem.

I re-read the official guide and other online the articles mentioning the installation of opennebula and sunstone

I then re-image my computer and started fresh again.

Below is the list of the steps I took to install OpenNebula and SunStone on a CentoOS box

1 – Add EPL to the yum repo list

[sourcecode language=”bash”]
yum repolist
wget https://fedoraproject.org/static/0608B895.txt
mv 0608B895.txt /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm -ivh epel-release-6-5.noarch.rpm
rpm -qa gpg*
yum clean all
yum update

A more complete explanation about EPL

2 – GroupInstall Virtualization and Development Tools

[sourcecode language=”bash”]
sudo yum groupinstall “Development Tools”
sudo yum groupinstall Virtualization

3 – Download latest packages for OpenNebula

Downloads Page

I selected the OpenNebula 3.8.1 CenOS 6.3 tarball

The contents of the downloaded package are:

  • opennebula
  • opennebula-sunstone
  • opennebula-java

I first installed the OpenNebula rpm, followed by the sunstone and java packages.

4 – Install OpenNebula

To install all the required dependencies for OpenNebula install the package with yum:

[sourcecode language=”bash”]
sudo yum localinstall opennebula-3.8.1-1.x86_64.rpm

5 – Install gems

Before installing gems one dependency is required:

[sourcecode language=”bash”]
sudo yum install redhat-lsb
sudo ./install_gems

6 – This part I had some problems, so there might exist a simpler way to circumvent or even prevent this problem

My guess is that since I didn’t have mysql up and running the creation of the credentials for the oneadmin user were not effective, but I’m not sure.

Another issue I was facing was that I wasn’t able to log in with the oneadmin user
If I tried:

[sourcecode language=”bash”]
su oneadmin

it would ask for the password but I didn’t know the password since the user was created during the installation of OpenNebula.
That was really throwing me off since on the official guide they tells you to log in with the oneadmin before setting the credentials for it

Since it wasn’t working I tried the contrary:

[sourcecode language=”bash”]
echo "oneadmin:yourpasshere" > /var/lib/one/.one/one_auth

I’ve tried to log in again with the oneadmin user.
It didn’t work.
I then log as root and then tried again to log in as oneadmin.
This time worked.

*If anybody knows why I can log in with the oneadmin user when I’m root but not when I have my default user account please leave a comment below :)

Anyway, I was able to log in with the oneadmin user so I kept moving on

7 – Configure ssh

This part is pretty straight forward and the official guide covers it very well:

Logged as oneadmin:

[sourcecode language=”bash”]
cat ~/.ssh/idrsa.pub >> ~/.ssh/authorizedkeys
chmod 700 ~/.ssh/
chmod 600 ~/.ssh/idrsa.pub
chmod 600 ~/.ssh/id
chmod 600 ~/.ssh/authorizedkeys
chmod 600 ~/.one/one

cd ~/.ssh
vim config
Host *
StrictHostKeyChecking no

8 – Starting OpenNebula

Logged as oneadmin

[sourcecode language=”bash”]
one start

check if the user is properly configured by listing the vms

[sourcecode language=”bash”]
onevm list

Here is where I got the error that I mentioned earlier:

[“HostPoolInfo] User couldn’t be authenticated, aborting call”]

That was very frustrating, since no where in the official documentation had any mention of this.

Looking online I found one mail thread where somebody suggested a solution:

Before I get to the solution here is where I started the mysql service, as I said before the fact that mysql was off might have caused the error in the first place,

[sourcecode language=”bash”]
sudo chkconfig –levels 235 mysqld on
sudo service mysqld start

The solution as suggested by one of OpenNebula engineers was to remove the one.db file, located at the home of the oneadmin user.
The default location would be /var/lib/one
The next time OpenNebula is started it will use the credentials copied earlier to the *one_auth
file and then create the one.db file with the correct credentials.

Indeed that solution worked.

Logged as oneadmin

[sourcecode language=”bash”]
one stop
cd ~
rm one.db
one start
onevm list

You should see something like:

9 – Installing Sunstone

Back to the folder where you extracted the OpenNebula package, install the sunstone and java packages:

Before installing sunstone, this dependencies are needed:

[sourcecode language=”bash”]
sudo yum install ruby rubygems rubygem-nokogiri rubygem-json rubygem-rack rubygem-sequel rubygem-sinatra rubygem-sqlite3-ruby rubygem-thin rubygem-uuidtools json sequel sqlite3

And also noVNC, OpenNebula has a script for that:

[sourcecode language=”bash”]
cd /usr/share/one
sudo ./install_novnc.sh

Now installing the sunstone and java packages:

[sourcecode language=”bash”]
sudo rpm -Uhv opennebula-sunstone-3.8.1-1.x8664.rpm
sudo rpm -Uhv opennebula-java-3.8.1-1.x86

10 – Start Sunstone

Logged as oneadmin:

[sourcecode language=”bash”]
one start
sunstone-server start

The sunstone server will be listening on port 9689
All the settings for sunstone are located at /etc/one/sunstone-server.conf

By now you should be able to access sunstone in your browser by going to

OpenNebula setup, Part 1

This will be the first of many blog posts to come outlining the process of setting up OpenNebula on a CentOS box and managing a small cluster of VMs.

First, a simple and good definition for OpenNebula:

…the open-source industry standard for data center virtualization, offering the most feature-rich, flexible solution for the comprehensive management of virtualized data centers to enable on-premise IaaS clouds

This diagram clearly shows the role of OpenNebula as far a Cloud infrastructure goes:

Even though the OpenNebula website is very complete and provides lots of good documentation and reference guides, a lot of that information is still out of context for me.
I haven’t dealt with cloud infrastructure before, so it is hard to put all these features and solutions that OpenNebula provides in context.
I guess once we have a small cloud set up it will start becoming clear the problems OpenNebula was designed to solved.

With all that being said lets get started!

I’ll be following the official tutorial posted on opennebula.org:

There are a few ways to install OpenNebula, they have prebuilt packages for a few Linux Distros and also provide the source code for whoever wants to build from source.
Later I plan to build from source, for now I’ll be installing from one of their pre-built packages

Download page

I selected the option:
*OpenNebula 3.8.1 Download Source, RHEL/CentOS, Debian, openSUSE and Ubuntu Binary Packages Now!
Which took me to the another download page where I selected the distro I was interested in, my case CentOS.

The downloaded tar file came with three packages and the src code:


At first I tried to install the rpm packages by typing:

[sourcecode language=”bash”]
[diogogmt@localhost opennebula-3.8.1]$ sudo rpm -Uvh opennebula-3.8.1-1.x8664.rpm
error: Failed dependencies:
libxmlrpc++.so.4()(64bit) is needed by opennebula-3.8.1-1.x86
libxmlrpcclient++.so.4()(64bit) is needed by opennebula-3.8.1-1.x8664
libxmlrpcserver++.so.4()(64bit) is needed by opennebula-3.8.1-1.x8664
libxmlrpcserverabyss++.so.4()(64bit) is needed by opennebula-3.8.1-1.x8664
rubygem-json is needed by opennebula-3.8.1-1.x86
rubygem-nokogiri is needed by opennebula-3.8.1-1.x8664
rubygem-rack is needed by opennebula-3.8.1-1.x86
rubygem-sequel is needed by opennebula-3.8.1-1.x8664
rubygem-sinatra is needed by opennebula-3.8.1-1.x86
rubygem-sqlite3-ruby is needed by opennebula-3.8.1-1.x8664
rubygem-thin is needed by opennebula-3.8.1-1.x86
rubygem-uuidtools is needed by opennebula-3.8.1-1.x8664
rubygems is needed by opennebula-3.8.1-1.x86

However it gave me an error saying the package needed some dependencies.

Instead of installing each dependency by hand, yum has a nice feature that installs all the dependencies automatically:

[sourcecode language=”bash”]
[diogogmt@localhost opennebula-3.8.1]$ sudo yum localinstall opennebula-3.8.1-1.x86_64.rpm

After installing all the three packages the next step was to install the required ruby gems.

[sourcecode language=”bash”]
sudo /usr/share/one/install_gems

installs_gems is nothing more than a ruby script.
A snippet of the script:

[sourcecode language=”ruby”]
:debian => {
:id => [‘Ubuntu’, ‘Debian’],
:dependencies => {
SQLITE => [‘gcc’, ‘libsqlite3-dev’],
‘mysql’ => [‘gcc’, ‘libmysqlclient-dev’],
‘curb’ => [‘gcc’, ‘libcurl4-openssl-dev’],
‘nokogiri’ => %w{gcc rake libxml2-dev libxslt1-dev},
‘xmlparser’ => [‘gcc’, ‘libexpat1-dev’],
‘thin’ => [‘g++’],
‘json’ => [‘make’, ‘gcc’]
:installcommand => ‘apt-get install’,
env => {
‘rake’ => ‘/usr/bin/rake’
:redhat => {
:id => [‘CentOS’, /^RedHat/],
:dependencies => {
SQLITE => [‘gcc’, ‘sqlite-devel’],
‘mysql’ => [‘gcc’, ‘mysql-devel’],
‘curb’ => [‘gcc’, ‘curl-devel’],
‘nokogiri’ => %w{gcc rubygem-rake libxml2-devel libxslt-devel},
‘xmlparser’ => [‘gcc’, ‘expat-devel’],
‘thin’ => [‘gcc-c++’],
‘json’ => [‘make’, ‘gcc’]
:installcommand => ‘yum install’
:suse => {
:id => [/^SUSE/],
:dependencies => {
SQLITE => [‘gcc’, ‘sqlite3-devel’],
‘mysql’ => [‘gcc’, ‘libmysqlclient-devel’],
‘curb’ => [‘gcc’, ‘libcurl-devel’],
‘nokogiri’ => %w{rubygem-rake gcc rubygem-rake libxml2-devel libxslt-devel},
‘xmlparser’ => [‘gcc’, ‘libexpat-devel’],
‘thin’ => [‘rubygem-rake’, ‘gcc-c++’],
‘json’ => [‘make’, ‘gcc’]
command => ‘zypper install’

It checks which distro you are running and then install the correct packages for it.

When I tried to run the script I bumped into two problems:

[sourcecode language=”bash”]
[diogogmt@localhost opennebula-3.8.1]$ sudo /usr/share/one/install_gems
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h
ruby development package is needed to install gems

[diogogmt@localhost opennebula-3.8.1]$ sudo /usr/share/one/installgems
ruby/1.8/rubygems/customrequire.rb:31: command not found: lsbrelease -a
lsb_release command not found. If you are using a RedHat based
distribution install redhat-lsb


To fix those problems I installed the following packages:

  • ruby-devel
  • redhat-lsb

This time running the install_gems script installed all the dependencies, without errors.

The next sections from the official OpenNebula tutorial explained how to configure the user oneadmin in the FronteEnd and Hosts.

They refer to FrontEnd when talking about the machine that has OpenNebula installed and Hosts for the machines belonging to the cloud setup.

An important point to mention is that OpenNebula only needs to be installed on the FronteEnd, all the hosts only need to a ssh server, hypervisors and ruby installed.

For the oneadmin user configuration I followed the steps listed on the tutorial but I didn’t have a chance to look deeper on what is actually happening.

I’ll go over that configuration steps again once I configure a host computer.
Since right now there are no other computers with hypervisors installed in the network it is hard to test if the oneamdin is properly configured.

The last part of the tutorial was to actually start OpenNebula and test if everything was installed:

*All the interaction of OpenNebula needs to be done via the oneadmin user

So before running the commands below I needed to switch the terminal session to the oneadmin user:

[sourcecode language=”bash”]
su oneadmin

First set the credentials for oneadmin user

[sourcecode language=”bash”]
$ mkdir ~/.one
$ echo "oneadmin:password" > ~/.one/oneauth
$ chmod 600 ~/.one/one

To start opennebula:

[sourcecode language=”bash”]
one start

However OpenNebula didn’t start, I got an error instead

[sourcecode language=”bash”]
[oneadmin@localhost ~]$ one start
Could not open database.
oned failed to start

Well, it turns out that I couldn’t even start mysql, no wonder why OpenNebula wasn’t able to open the database

[sourcecode language=”bash”]
[diogogmt@localhost opennebula-3.8.1]$ mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

Searching about the error above, I actually found out mysql wasn’t fully installed on my machine. I wasn’t able to start mysql as a service.

I thought that OpenNebula had installed mysql before, but I guess it didn’t, either way I just installed the mysql pakcages again:

[sourcecode language=”bash”]
yum install mysql-server mysql mysql-client

Then configured mysql to start on boot

[sourcecode language=”bash”]
chkconfig –levels 235 mysqld on
[sourcecode language=”bash”]
service mysqld start

After running those commands I was able to start mysql.

I then tried one more time to start OpenNebula

[sourcecode language=”bash”]
[oneadmin@localhost ~]$ one start
Could not open database.
oned failed to start

But again I got the same error.

I started looking online for possible solutions for the error I was getting but didn’t have any luck.

I remembered reading at beginning of the tutorial that all the logs for OpenNebula are saved.
They have a very good diagram explaining all the directories used by OpenNebula:

I took a look on the /var/log/one/one.d file
That provided some very good information:

OpenNebula Configuration File
DATASTOREMAD=ARGUMENTS=-t 15 -d fs,vmware,vmfs,iscsi,lvm,EXECUTABLE=onedatastore

The DB was set to sqlite.
I didn’t have sqlite installed, no wonder why the OpenNebula wasn’t being able to Open the DB

I went to the configuration file where all the settings for OpenNebula are defined:


Indeed the DB was set to sqlite:

DB = [ backend = "sqlite" ]
# Sample configuration for MySQL
# DB = [ backend = "mysql",
# server = "localhost",
# port = 0,
# user = "oneadmin",
# passwd = "oneadmin",
# db_name = "opennebula" ]

I uncommented the configuration for mysql and commented out the one for sqlite

The last thing left to do was to create the database and user for mysql:

[sourcecode language=”mysql”]
mysql> CREATE DATABASE opennebula;

mysql> GRANT ALL ON opennebula.* TO oneadmin@localhost IDENTIFIED BY ‘oneadmin';

This time when I tried to run OpenNebula everything worked as expected!

[sourcecode language=”bash”]
[oneadmin@localhost diogogmt]$ one start
[oneadmin@localhost diogogmt]$ onevm list

Next step is to understand how the ssh configuration works for the Front-End and Hosts and try to set up a small cluster of Hypervisors and use OpenNebula to manage them.