How to Install OpenNMS on Ubuntu Linux

OpenNMS is an open-source, enterprise-grade platform to build network monitoring solutions, and you gain insights from your networking devices so you can make sense of their logs.

It helps you monitor, search, and analyze the vast amount of data (especially in larger environments) into a simple format you can easily read and digest.

OpenNMS automatically discovers your entire network using CDP, FDP, LLDP, OSPF, BGP, SNMP, and ARP and provides alerts via email, slack, and support for Microblog notifications via Identica / StatusNet / Twitter, and more.

Most of the network devices in use today support protocols that work with OpenNMS — from many significant manufacturers… including the vast majority of the networking devices deployed…

For more about OpenNMS, please check its homepage.

Since OpenNMS is based on Java and requires Java to function, you’ll want to install Java JDK. The open-source version of JavaJDK works excellently, so use the steps below to install and configure it on Ubuntu.

Install OpenJDK on Ubuntu

Run the commands below to install OpenJDK on the Ubuntu desktop.

sudo apt update
sudo apt install default-jdk

That should install the latest OpenJDK on Ubuntu. At the time of this writing, the latest OpenJDK version was 11.

After installing OpenJDK, run the commands below to configure it as the default JDK runtime for Ubuntu. To find out which version of JDK to run, type the commands below:

sudo update-alternatives --config java

If you have multiple versions, you’ll see OpenJDK on the list. If only OpenJDK is installed, you should see a message that only one alternative for Java exists.

There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java
Nothing to configure.

Take notes of where JAVA is located.

Next, copy the installation path of your preferred JDK home. Next, open the /etc/environment file:

sudo nano /etc/environment

Add the following line at the end of the file:


Closeout and save. Then run the commands below to apply.

source /etc/environment

When you’re done, OpenJDK should be installed and ready to use.

Downloading OpenNMS

After installing OpenJDK to your system, run the commands below to Add the apt repository in /etc/apt/sources.list.d/opennms.list and add the GPG key.

To do that, run the commands below to create new opennms—list file.

sudo nano /etc/apt/sources.list.d/opennms.list

Then copy and paste the lines below into the file and save.

deb stable main
deb-src stable main

After that, run the commands below to add the repository PGP key.

wget -O - | sudo apt-key add -

Finally, run the commands below to install OpenNMS packages, including all dependencies.

sudo apt update
sudo apt install opennms

The above commands will install the OpenNMS meta package with all built-in dependencies such as jicmp6 and jicmp, OpenNMS-core, OpenNMS-web app-jetty, PostgreSQL, and postgresql-libs.

With the successful installed packages, the OpenNMS Horizon is installed in the following directory structure:

[root@localhost /usr/share/opennms]# tree -L 1
└── opennms
   ├── bin
   ├── data
   ├── deploy
   ├── etc -> /etc/opennms
   ├── instances
   ├── jetty-webapps
   ├── lib -> ./java/opennms
   ├── logs -> /var/log/opennms
   ├── share -> /var/lib/opennms
   └── system

With the successful installed packages, the OpenNMS Horizon is installed in the following directory structure:

The Debian package installs the PostgreSQL database and is already initialized. Therefore, the PostgreSQL service is already added in the runlevel configuration for system startup.

Startup the PostgreSQL database by running the commands below:

sudo systemctl start postgresql

After installing PostgreSQL, it’s a good idea to create/change the default PostgreSQL user password. Run the below commands to create/change the user password in the bash shell, not the PostgreSQL interactive shell.

Set password for Linux user (Postgres)

sudo passwd postgres

You should be prompted to create a new Linux password for Postgres users.

Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

After setting a new password, whenever you want to access PostgreSQL interactive shell, you’ll be prompted to confirm the password you created after running the above commands.

Next, create an opennms database user with a password and create an opennms database which is owned by the user opennms

sudo su -l postgres
createuser -P opennms
createdb -O opennms opennms

Set a password for Postgres super user.


Next, configure database access in OpenNMS Horizon

sudo nano /etc/opennms/opennms-datasources.xml

Make the highlighted changes below, then save.

<jdbc-data-source name="opennms"

  • Set credentials to access the PostgreSQL database
  • Set the database name OpenNMS Horizon should use
  • Set the user name to access the opennms database table
  • Set the password to access the opennms database table
  • Set the postgres user for administrative access to PostgreSQL
  • Set the password for administrative access to PostgreSQL

Save and exit.

Detect of Java environment and persist in /usr/share/opennms/etc/java.conf

sudo /usr/share/opennms/bin/runjava -s

You should see the output below:

runjava: Looking for an appropriate JVM.
runjava: Checking for an appropriate JVM in JAVA_HOME.
runjava: Found: "/usr/lib/jvm/java-11-openjdk-amd64/bin/java" is an appropriate JVM.
runjava: Value of "/usr/lib/jvm/java-11-openjdk-amd64/bin/java" stored in configuration file.

If you are getting an error starting OpenNMS, manually add the JAVA_HOME settings using the commands below:

sudo nano /etc/default/opennms

Then add the highlighted line in the file and save

# Set JAVA_HOME if it cannot be auto-detected


Initialize the database and detect system libraries persisted in /opt/opennms/etc/

sudo /usr/share/opennms/bin/install -dis

You should see an output similar to the one below:

Processing DiscoveryConfigurationLocationMigratorOffline: Changes the name for the default location from 'localhost' to 'Default'. See HZN-940.
- Running pre-execution phase
  Backing up discovery-configuration.xml
    Zipping /usr/share/opennms/etc/discovery-configuration.xml
- Running execution phase
- Saving the execution state
- Running post-execution phase
  Removing backup /usr/share/opennms/etc/

Finished in 0 seconds
Upgrade completed successfully!

Configure systemd to start OpenNMS Horizon on the system boot

sudo systemctl enable opennms
sudo systemctl start opennms

Finally, the OpenNMS web application at http://localhost:8980/opennms. The default login user is admin, and the password is initialized to admin.


Username: admin
Password: admin

OpenNMS Ubuntu Install

Log in and start configuring your settings.

OpenNMS Ubuntu setup


You may also like the post below: