7 min read

(For more resources related to this topic, see here.)

Step 1 – preparing for the deployment

OpenNMS is a large and complex piece of software and its deployment can be intimidating. Making sure we are prepared will save us a lot of trouble along the road. Here are some of the things needed before getting started:

Step 2 – setting up OpenNMS software repositories

OpenNMS conveniently makes available its software to several operating systems through their native software repository applications (for example, APT, YUM, and fink). The procedure for this will depend on your platform; instructions can be found at http://www.opennms.org/documentation/installguide.html#before-you-begin. Users of Windows can safely ignore this step as there is a standalone package providing a more Windows-like installation procedure.

Step 3 – installing the Java Development Kit (JDK)

Normally, Java software only needs the Java Runtime Environment (JRE) to be installed to run. But this will not be sufficient, you must install the JDK, either the OpenJDK implementation or Oracle’s. The installation is straight forward and detailed at http://www.opennms.org/documentation/installguide.html#java. The default options are fine to get started.

If installing on Windows, both the 3 2-bit and 64-bit JDK are available on Oracle’s website. Bear in mind that the JDK must match the OpenNMS standalone setup executable that you will run.

Step 4 – installing and configure PostgreSQL

PostgreSQL is usually available in Linux with excellent support from the operating systems’ repositories. Otherwise, there are available binaries for other common operating systems. Here, instructions will diverge a little from OpenNMS’s available documentation at http://www.opennms.org/documentation/installguide.html#postgresql, which are meant to get you started with as little fuss as possible at the expense of security.

Access controls will be configured using encrypted passwords (not using trust authentication as in the online tutorials). This can be achieved by editing the pg_hba.conf file; its location will vary depending on your platform. On CentOS 6 it is located in /var/lib/pgsql/data/ and on Debian 6 in /etc/postgresql/8.4/main/ (refer to your OS documentation).

Locate the following configuration lines and edit the authentication method to use md5 encrypted passwords as shown in the following code. You will need to reload or restart the service for changes to take effect:

# "local" is for Unix domain socket connections only
local all postgres md5
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5

The PostgreSQL defaults in postgresql.conf should be fine, but to take advantage of OpenNMS’ ability to scale you will need to tune PostgreSQL further. A good starting point is going through http://www.opennms.org/documentation/installguide.html#postgresql-configure and http://www.opennms.org/documentation/installguide.html#performance-tuning.

To complete the database setup we will execute some SQL commands from the command line to do a number of initial tasks. The following code shows how to set a strong password for the PostgreSQL user postgres , create a database user called opennms with restricted privileges and a password of your choice, and create a database called opennms owned by our new opennms user (creating the database manually is not necessarily and would also be taken care of by the installer):

# su - postgres
$ psql -c "ALTER USER postgres WITH PASSWORD 'newpassword'" -d
template1
$ psql -c "CREATE USER opennms WITH LOGIN ENCRYPTED PASSWORD
'opennmspassword';"
$ psql -c "CREATE DATABASE opennms WITH OWNER=opennms ENCODING
'UNICODE';"

With a new database at our disposal we can now start importing functions and data into it. The next step is to install the iplike package that contains an optimized function to do lookups based on IP addresses. It is usually available in your OS software repository.

If you are on Windows, you do not have to do this explicitly. It is taken care automatically by the standalone OpenNMS package.

Once installed, you may have to run a script as shown in the following code to install the function in the opennms database:

# install_iplike.sh

If you are not using opennms (the default) as the database name you will have to edit the iplike script to change the database name manually. If you are using PostgreSQL 9.0 or later the procedural language is already installed by default, otherwise it needs to be installed in the opennms database with the following command:

# createlang -U postgres plpgsql opennms

If you are on Windows, you will be installing the OpenNMS standalone package. You do not need to worry about installing iplike or the plpgsql procedural language as both of them will be installed automatically.

Step 5 – installing OpenNMS

Before we go ahead with the OpenNMS installation, it is a good time to install the remaining optional dependencies jicmp and jrrd. On Windows those dependencies come with the standalone package and you do not need to do anything. On other OS it should be pulled in as a dependency when installing using APT, YUM, or fink.

We are now ready to install OpenNMS as detailed at http://www.opennms.org/documentation/installguide.html#installing; instructions are included for various platforms. Once installation of OpenNMS software is complete, either through the software repositories or using the standalone package for Windows, you must take care to properly configure it for database access.

Locate the file $OPENNMS_HOME/etc/opennms-datasources.xml and edit the data sources as shown in the following code:

<jdbc-data-source name="opennms"
database-name="opennms"
class-name="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/opennms"
user-name="opennms"
password="opennmspassword" />

<jdbc-data-source name="opennms-admin"
database-name="template1"
class-name="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/template1"
user-name="postgres"
password="newpassword" />

If everything was done correctly up to this point the OpenNMS installation can now be completed. First, optionally tell OpenNMS to find a suitable JRE (from your JDK) and then finalize the OpenNMS deployment using the install tool that comes with it. Essentially, the following two commands should be executed:

# $OPENNMS_HOME/bin/runjava -s
# $OPENNMS_HOME/bin/install -dis

If the installation was successful you should be able to start the OpenNMS service. The command for doing this will depend on your platform and method of installation:

On debian it is as simple as the following command:

# service opennms start

Red Hat systems like Fedora moved to the systemctl service manager, it would be something more like the following command:

# systemctl start opennms.service

On Windows you can do the following:

# cd C:Program FilesOpenNMSbin
# opennms.bat start

And that’s it

Once started we can log in to OpenNMS with the credentials admin/admin using a browser pointed at http : //localhost:8980/opennms. If this is your first time installing a large Java system, there is a good chance it will not work the first time around. Don’t give up, the scary errors are simply likely the result of one or two minor mistakes along the way. Repeat and verify each step all over again.

Summary

Installation helps you learn how to download and install OpenNMS with the minimum fuss and then set it up so that you can use it as soon as possible.

Resources for Article:


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here