How to Configure OpenNMS on CentOS 7

OpenNMS is a free and open-source enterprise-level network monitoring and management platform that provides information to allow us to make decisions in regards to future network and capacity planning.

OpenNMS designed to manage tens of thousands of devices from a single server as well as manage unlimited devices using a cluster of servers. It includes a discovery engine to automatically configure and manage network devices without operator intervention. It is written in Java and is published under the GNU General Public License. OpenNMS is known for its scalability with its main functional areas in services monitoring, data collection using SNMP, and event management and notifications.

In this tutorial we learn how to install OpenNMS on CentOS 7 system.

Installing OpenNMS RPM Repository

We will start with the installation of OpenNMS RPM for our CentOs 7.1 operating system. It's available for most of the RPM-based distributions through OpenNMS Yum Repository.


Then open your command line interface of CentOS 7.1 and login with root credentials to run the below command with “wget” to get the required RPM.

# wget
Download RPM

Now we need to install this repository so that the OpenNMS package information could be available through yum for installation. Let’s run the command below with same root level credentials to do so.

# rpm -Uvh opennms-repo-stable-rhel7.noarch.rpm
Installing RPM

Installing Prerequisite Packages for OpenNMS

Now before we start installation of OpenNMS, let’s make sure you’ve done the following prerequisites.

Install JDK 7

Its recommended that you install the latest stable Java 7 JDK from Oracle for the best performance to integrate JDK in our YUM repository as a fallback. Let’s go to the Oracle Java 7 SE JDK download page, accept the license if you agree, choose the platform and architecture. Once it has finished downloading, execute it from the command-line and then install the resulting JDK rpm.

Else run the below command to install using the Yum from the the available system repositories.

# yum install java-1.7.0-openjdk-

Once you have installed the Java you can confirm its installation using below command and check its installed version.

# java -version
Java version

Install PostgreSQL

Now we will install the PostgreSQL that is a must requirement to setup the database for OpenNMS. PostgreSQL is included in all of the major YUM-based distributions. To install, simply run the below command.

# yum install postgresql postgresql-server
Installing Postgresql

Prepare the Database for OpenNMS

Once you have installed PostgreSQL, now you'll need to make sure that PostgreSQL is up and active. Let’s run the below command to first initialize the database and then start its services.

# /sbin/service postgresql initdb
# /sbin/service postgresql start
start DB

Now to confirm the status of your PostgreSQL database you can run the below command.

# service postgresql status
PostgreSQL status

To ensure that PostgreSQL will start after a reboot, use the “systemctl”command to enable start on bootup using below command.

# systemctl enable postgresql
ln -s '/usr/lib/systemd/system/postgresql.service' '/etc/systemd/system/'

Configure PostgreSQL

Locate the Postgres “data” directory. Often this is located in /var/lib/pgsql/data directory and Open the postgresql.conf file in text editor and configure the following parameters as shown.

# vim /var/lib/pgsql/data/postgresql.conf

listen_addresses = 'localhost'
max_connections = 256


shared_buffers = 1024MB

User Access to the Database

PostgreSQL only allows you to connect if you are logged in to the local account name that matches the PostgreSQL user. Since OpenNMS runs as root, it cannot connect as a "postgres" or "opennms" user by default, so we have to change the configuration to allow user access to the database by opening the below configuration file.

# vim /var/lib/pgsql/data/pg_hba.conf

Update the configuration file as shown below and change the METHOD settings from "ident" to "trust"

user access to db

Write and quit the file to make saved changes and then restart PostgreSQL services.

# service postgresql restart

Starting OpenNMS Installation

Now we are ready go with installation of OpenNMS as we have almost don with its prerequisites. Using the YUM packaging system will download and install all of the required components and their dependencies, if they are not already installed on your system.
So let's riun th belwo command to start OpenNMS installation that will pull everything you need to have a working OpenNMS, including the OpenNMS core, web UI, and a set of common plugins.

# yum -y install opennms
OpenNMS Installation

The above command will ends up with successful installation of OpenNMS and its derivative packages.

Configure JAVA for OpenNMS

In order to integrate the default version of Java with OpenNMS we will run the below command.

# /opt/opennms/bin/runjava -s
java integration

Run the OpenNMS installer

Now it's time to start the OpenNMS installer that will create and configure the OpenNMS database, while the same command will be used in case we want to update it to the latest version. To do so, we will run the following command.

# /opt/opennms/bin/install -dis

The above install command will take many options with following mechanism.

-d - to update the database
-i - to insert any default data that belongs in the database
-s - to create or update the stored procedures OpenNMS uses for certain kinds of data access

OpenNMS Installer

Configures PostgreSQL tables, users, and other miscellaneous settings.

DEBUG: Platform is IPv6 ready: true
- searching for
- trying to load /usr/lib64/ OK
- searching for
- trying to load /usr/lib64/ OK
- searching for
- trying to load /usr/lib64/ OK
- using SQL directory... /opt/opennms/etc
- using create.sql... /opt/opennms/etc/create.sql
17:27:51.178 [Main] INFO org.opennms.core.schema.Migrator - PL/PgSQL call handler exists
17:27:51.180 [Main] INFO org.opennms.core.schema.Migrator - PL/PgSQL language exists
- checking if database "opennms" is unicode... ALREADY UNICODE
- Creating imports directory (/opt/opennms/etc/imports... OK
- Checking for old import files in /opt/opennms/etc... DONE
INFO 16/08/15 17:27:liquibase: Reading from databasechangelog
Installer completed successfully!

OpenNMS Upgrader

OpenNMS is currently stopped
Found upgrade task SnmpInterfaceRrdMigratorOnline
Found upgrade task KscReportsMigrator
Found upgrade task JettyConfigMigratorOffline
Found upgrade task DataCollectionConfigMigratorOffline
Processing RequisitionsMigratorOffline: Remove non-ip-snmp-primary and non-ip-interfaces from requisitions: NMS-5630, NMS-5571
- Running pre-execution phase
Backing up: /opt/opennms/etc/imports
- Running post-execution phase
Removing backup /opt/opennms/etc/

Finished in 0 seconds

Upgrade completed successfully!

Firewall configurations to Allow OpenNMS

Here we have to allow OpenNMS management interface port 8980 through firewall or router to access the management web interface from the remote systems. So use the following commands to do so.

# firewall-cmd --permanent --add-port=8980/tcp
# firewall-cmd --reload

Start OpenNMS and Login to Web Interface

Let's start OpenNMS service and enable to it start at each bootup by using the below command.

#systemctl start opennms
#systemctl enable opennms

Once the services are up are ready to go with its web management interface. Open your web browser and access it with your server's IP address and 8980 port.


Give the username and password where as the default username and password is admin/admin.

opennms login

After successful authentication with your provided username and password you will be directed towards the the Home page of OpenNMS where you can configure the new monitoring devices/nodes/services etc.

opennms home


Congratulations! we have successfully setup OpenNMS on CentOS 7.1. So, at the end of this tutorial, you are now able to install and configure OpenNMS with its prerequisites that included PostgreSQL and JAVA setup. So let's enjoy with the great network monitoring system with open source roots using OpenNMS that provide a bevy of features at no cost than their high-end competitors, and can scale to monitor large numbers of network nodes.

3 Comments... add one

  1. I just followed this procedure but had to use a later version of java since 1.7 is no longer available for CentOS7:

    openjdk version "1.8.0_101"
    OpenJDK Runtime Environment (build 1.8.0_101-b13)
    OpenJDK 64-Bit Server VM (build 25.101-b13, mixed mode)

    When I install I get a java exception at the upgrade step:

    OpenNMS Upgrader

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at org.opennms.bootstrap.Bootstrap$
    Caused by: java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException
    at org.opennms.netmgt.vmmgr.ControllerUtils.getController(
    ... 6 more
    Caused by: java.lang.ClassNotFoundException:
    at java.lang.ClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    ... 10 more

    And, of course it won't start, throwing an exception with the same root cause:

    Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(
    at java.lang.Class.privateGetMethodRecursive(
    at java.lang.Class.getMethod0(
    at java.lang.Class.getMethod(
    at org.opennms.bootstrap.Bootstrap.executeClass(
    at org.opennms.bootstrap.Bootstrap.executeClass(
    at org.opennms.bootstrap.Bootstrap.main(
    Caused by: java.lang.ClassNotFoundException:
    at java.lang.ClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    ... 8 more

    • Dan,

      Did you have any luck resolving this issue, as I seem to have the same problem. I was trying to get this installed on CentOS 7.3.1611 and it looks like it has hava 1.8.0_141 by default.

      java -version
      openjdk version "1.8.0_141"
      OpenJDK Runtime Environment (build 1.8.0_141-b16)
      OpenJDK 64-Bit Server VM (build 25.141-b16, mixed mode)

      I wonder if it's an environmental variable setting between the two different versions of java or if I'd be better off rebuilding this system to run CentOS 7.1.

      Any ideas or help would be greatly appreciated since this looks like a great product.



Leave a Comment