Install OpenNMS on RHEL and CentOS

How to install OpenNMS on RHEL and CentOS.

This guide applies to:
Red Hat Enterprise Linux 5 (RHEL5)
Red Hat Enterprise Linux 6 (RHEL6)
CentOS 5
CentOS 6
OpenNMS 1.8
OpenNMS 1.9

- Install PostgreSQL

Install portgresql-server

yum install postgresql-server -y

Initiate the database

service postgresql initdb

Configure PostgreSQL for OpenNMS
Open /var/lib/pgsql/data/pg_hba.conf in your favorite text editor. In the bottom of the file, replace “ident” with “trust” for localhost (127.0.0.1/32 ).

Before: 
local   all    all                        ident
host    all    all        127.0.0.1/32    ident
host    all    all        ::1/128         ident     

After:
local   all    all                        ident
host    all    all        127.0.0.1/32    trust
host    all    all        ::1/128         ident

Add automaic startup of PostgreSQL in your current runlevel

chkconfig postgresql on

Start PostgreSQL

service postgresql start

Create the OpenNMS database
Run createdb as the postgres user.

su - postgres -c "createdb -U postgres -E UNICODE opennms"

- Install OpenNMS

Add OpenNMS to your yum repository
Get the repository rpm path from http://yum.opennms.org/. In this example, we select the stable release for RHEL 6 based distributions.

rpm -Uvh http://yum.opennms.org/repofiles/opennms-repo-stable-rhel6.noarch.rpm

Install OpenNMS
Install from opennms repository. The --nogppcheck option is for the jdk package.

yum install opennms -y --nogpgcheck

Configure java for OpenNMS

/opt/opennms/bin/runjava -s

Run the installer
Run the installer to set up OpenNMS.

/opt/opennms/bin/install -dis

Add automatic start and run OpenNMS
Add automatic start to your current runlevel.

chkconfig opennms on

Start the OpenNMS service.

service opennms start

Configure the firewall
Open port 8980/tcp in the firewall.

iptables -I INPUT -p tcp -m tcp --dport 8980 -j ACCEPT

Save the firewall configuration.

service iptables save

Log in
Start your web browser and go to http://[host-ip]:8980/opennms/ (for example http://192.168.1.10:8980/opennms/) and log in with the credentials admin/admin.

- If you encounter problems

OpenNMS service does not start
If you get this error:

Starting OpenNMS: Started OpenNMS, but it stopped running: for details see /opt/opennms/logs/daemon/output.log

... you probably has this error in /opt/opennms/logs/daemon/output.log:

Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: hostname.localdomain: hostname.localdomain

The OpenNMS host must be able to resolve itself in DNS. Add the local hostname to /etc/hosts.

Graphs does not work
If you have this error in /opt/opennms/logs/webapp/jetty.log:

2011-11-18 19:02:55,351 WARN  [1366691408@qtp-650647154-22] JRobinRrdStrategy: JRobin: Unrecognized graph argument:
2011-11-18 19:02:55,377 ERROR [1366691408@qtp-650647154-22] log: /opennms/graph/graph.png
java.lang.Error: Probable fatal error:No fonts found.
2011-11-18 18:48:23,674 ERROR [1903237018@qtp-650647154-9] log: Error for /opennms/charts
java.lang.Error: Probable fatal error:No fonts found.
        at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1088)
        at sun.font.FontManager.initialiseDeferredFont(FontManager.java:960)

… add some fonts to your system:

yum install liberation-mono-fonts urw-fonts -y

… and restart OpenNMS:

service opennms restart
Tags: 

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer