Skip to main content

How to install RHQ on CentOS

Centos full

This guide was originally written for a work project, but I was given permission to blog about it.

My Virtual Machine Setup

You can of course use whatever you would like but this is my setup.

OS: CentOS 6.3 64-bit Desktop
Virtual Machine Software: VMWare Player
Virtual Machine Specs: about 2-3GB of memory and 2 Processors

Install the OS with VMWare Player, its handy Easy Install will do most of that work for you, so you can walk away until it's finished.



Linux/CentOS Usage Notes

For those unfamiliar with Linux here are some quick notes
If you are not comfortable with using vi, simply replace any instance of ‘vi’ with ‘nano’.
Nano is a much more user-friendly command line text editor.

Nano overview of nano 


  •  Keys work as you would expect, you can type instantly and arrows move the cursor around. Move the cursor down past the bottom to scroll.     
  • Press Ctrl-O (shown as ^O) to save (shown as WriteOut)
  •   Press Ctrl-X to exit (Shown as ^X)
  • Since you now know what the ^ means (ctrl key) you can read the menu at the bottom of the screen easily!
Vi quick commands:


  • Press i (or the insert key) to go into Insert mode. Press Esc to exit Insert mode.
  • Type :wq (then press enter) to save and quit
  • Type :q (then hit enter) to quit without saving.

Download and Install Requirements

NOTE: The install commands are assuming you are using CentOS. If you are using another package manager you may have to replace the "yum" commands with something else such as "apt-get"

Go to https://docs.jboss.org/author/display/RHQ/Download+RHQ and download the newest version of RHQ (rhq-server.4.6.0.zip at the time of writing). Continue with the following steps while it downloads.

1.       Open a Terminal Window

2.       Login as Super User
2.1.    Type su
2.2.    Enter password

3.       Install PosgreSQL
3.1.1. Type ‘yum install postgresql*’ making sure to include the asterisk (*)
3.1.2. Type ‘y’ when prompted (happens twice)

4.       Confirm java version
4.1.    Type ‘java –version
4.2.    Confirm it’s running at least 1.6 and using OpenJDK (or Oracle/Sun Java or JRockit, but NOT GNU Libgcj)

5.       (If not installed) Install Java
5.1.    Type ‘yum install java
5.2.    Type ‘y’ when prompted

6.       Add RHQ_SERVER_JAVA_HOME environmental variable
6.1.    Type ‘vi /etc/environment
6.2.    Add ‘RHQ_SERVER_JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64’ (or whichever version of Java is running of course)
6.3.    Save
6.4.    Type ‘source /etc/environment’ to load the variables
6.5.    Type ‘echo $RHQ_SERVER_JAVA_HOME’ and the output should be '/usr/lib/jvm/jre-1.6.0-openjdk.x86_64’
6.6.    Type ‘export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64
6.7.    Type ‘export PATH=$PATH:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64


Configure the PostgreSQL Database


1.       Initialize the database
1.1.    Type ‘/etc/init.d/postgresql initdb
This will add all the config files we need to edit


2.       Edit pg_hba.conf
2.1.    Type ‘vi /var/lib/pgsql/data/pg_hba.conf
2.2.    Change the last few lines from

# "local" is for Unix domain socket connections only

local   all         all                               ident

# IPv4 local connections:

host    all         all         127.0.0.1/32          ident



to




# "local" is for Unix domain socket connections only

local   all         all                               trust

# IPv4 local connections:

host    all         all         127.0.0.1/32          trust

3.       Start Postgres service
3.1.    Type ‘service postgresql start

4.       Add a user
4.1.    Type ‘psql postgres postgres’. You should be given a new prompt postgres=#

5.       Type CREATE USER rhqadmin with password ‘rhqadmin’;
with quotes NOTE: Don’t forget the semicolon, otherwise it will give you a new line to enter more text. If this happens simply enter a semicolon (;). Also be sure to use different names than these dummy ones.


6.       Create database
6.1.    Type CREATE DATABASE rhq owner=rhqadmin;

7.       Test Database connection
7.1.    Type ‘\c rhq rhqadmin’ to test connection
7.2.    Type ‘\q’ to exit psql

8.       Config postgresql to start on boot
8.1.    Type ‘chkconfig --list postgresql
Should display
postgresql         0:off      1:off      2:off      3:off      4:off      5:off      6:off
8.2.    Type ‘chkconfig --level 0123456 postgresql on
8.3.    Type ‘chkconfig --list postgresql’ (or hit the up arrow twice) to confirm config
Should display
postgresql                  0:on       1:on       2:on       3:on       4:on       5:on       6:on



Install RHQ

Once it’s downloaded unzip it

1.       Unzip using either the Archive Manager GUI or the command unzip rhq-server-4.6.0
1.1.    Commandline Option type: ‘unzip rhq-server-4.6.0.zip –d ../Desktop’ (if you’re in the Download directory)

2.       Change directory to the rhq server’s bin folder
2.1.    Type ‘cd /home/user/Desktop/rhq-server-4.6.0/bin/

3.       Start the server
3.1.    In the server bin directory type ‘./rhq-server.sh start

4.       Add password
4.1.    Type ‘./rhq-installer.sh --dbpassword=rhqadmin’ (that’s 2 dashes)        
So the installer has the correct password


5.       Edit the rhq-server.properties files
5.1.    Change rhq.autoinstall.enabled=false to true in the Installer Settings section

6.       Run the installer
6.1.    Type ‘./rhq-installer.sh

You can now access the following applications through firefox using ‘rhqadmin’ as both the username and password.

JBoss Application server http://localhost:6990
RHQ http://localhost:7080

Notes:
1.       I had an error logging into RHQ, may have been a typo on the password. To resolve I opened JBoss then RHQ then my password worked again. Opening and closing the webpages and retrying also seemed to fix it. Not entirely sure why this happens, but it was solvable within a few minutes each time.

2.       Do not forget the http:// if you are manually typing it out. Firefox does not recognize localhost:6990 as a webpage

To start all the services when logging in again:

Login as root (type ‘su’)
Type ‘/home/user/Desktop/rhq-server-4.6.0/bin/rhq-server.sh start’ to startup RHQ again


PostgreSQL should already be started.


Comments, Questions, and Criticism for this guide are appreciated to help keep it relevant!


Image Sources:
RHQ Logo - RHQ Homepage
CentOS logo - Wikimedia - License: Public Domain

Comments