December 3, 2021
How to install OpenNMS on Debian 11

How To Install OpenNMS Horizon on Debian 11

In this tutorial we will learn how to install OpenNMS Horizon Release 28.0.0 on Debian 11 operating system.

Introduction

OpenNMS (Open Network Management System) is a free and opensource java-based network monitoring tool. It is a network monitoring application which collect critical information from local and network hosts using the SNPM protocol. OpenNMS is written in Java providing web-based monitoring network traffics and can be installed on many platform including Linux and Windows operating systems. OpenNMS offers enterprise class monitoring system such like : traffic and performance monitoring, Event Management, Charting support and alarms and alerting system. On this article we will learn how to install OpenNMS on Debian 11 Linux operating system.

OpenNMS Installation On Debian 11

On this tutorial, we will install OpenNMS Horizon components including PostgreSQL on a single node. Before we start the installation, we have to meet the following system requirements:

  • Debian Linux physical server or a virtual machine running a supported Linux operating system
  • Internet access to download the installation packages
  • DNS works and localhost and your server’s host name resolve properly
  • System user with administrative permissions (sudo) to perform installation

The OpenNMS installation steps will be explained in below:

  • Update Debian 11 system
  • Install OpenJDK 11 on Debian
  • Adding OpernNMS repository and GPG key
  • Installing OpenNMS
  • Set up PostgreSQL Database
  • Initialize and Start OpenNMS Horizon
  • Configure Firewall using ufw
  • Accessing OpenNMS Horizon from the Browser

1. Update Debian 11 System

By updating our Debian 11 system, it will refresh the local list of available packages software to the newer stable version. To update and upgrade Debian 11 repositories, we will use the command line:

$ sudo apt-get update
$ sudo apt-get upgrade

2. Install OpenJDK 11 on Debian

OpenNMS requires Java installed on the system as an environment supporting to be live in properly. We will user OpenJDK 11 on the system. OpenJDK 11 installation on Debian issue has been already explained in the How To Install Java (OpenJDK) 11 on Debian 11 article. We will verify again by checking java version that is already installed on the system with the following command line:

$ java --version
ramansah@otodiginet:~$ java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.13+8-post-Debian-1deb11u1, mixed mode, sharing)

3. Adding OpernNMS repository and GPG key

We will add OpernNMS repository and GPG key to our Debian 11 system.

3.1. Add OpenNMS APT repository:

$ cat << EOF | sudo tee /etc/apt/sources.list.d/opennms.list
deb https://debian.opennms.org stable main
ramansah@otodiginet:~$ cat << EOF | sudo tee /etc/apt/sources.list.d/opennms.list
deb https://debian.opennms.org stable main
deb-src https://debian.opennms.org stable main
EOF

3.2. Import GPG key:

$ wget -O - https://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -
ramansah@otodiginet:~$ wget -O - https://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -
--2021-11-04 07:51:41--  https://debian.opennms.org/OPENNMS-GPG-KEY
Resolving debian.opennms.org (debian.opennms.org)... Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
3.214.84.83, 2a05:d014:ac:a660:2791:af0:3fab:a8cb
Connecting to debian.opennms.org (debian.opennms.org)|3.214.84.83|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1335 (1.3K)
Saving to: ‘STDOUT’

-                           100%[==========================================>]   1.30K  --.-KB/s    in 0s      

2021-11-04 07:51:43 (34.6 MB/s) - written to stdout [1335/1335]

OK

4. Install OpenNMS on Debian 11

We will run the following command to install the OpenNMS package to your system.

$ sudo apt update
$ sudo apt install opennms
ramansah@otodiginet:~$ sudo apt install opennms
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  exim4-base exim4-config exim4-daemon-light gsasl-common haveged iplike-pgsql13 jicmp jicmp6 libdbd-pg-perl
  libdbi-perl libgnutls-dane0 libgsasl7 libhavege2 libmailutils7 libmariadb3 libnet-snmp-perl libntlm0
  libopennms-java libopennmsdeps-java libpq5 libunbound8 libxml2-utils mailutils mailutils-common
  mariadb-common mysql-common opennms-common opennms-db opennms-server opennms-source opennms-webapp-jetty
  postgresql-13 postgresql-client-13 postgresql-client-common postgresql-common ssl-cert sysstat
Suggested packages:
  exim4-doc-html | exim4-doc-info eximon4 spf-tools-perl swaks libmldbm-perl libnet-daemon-perl
  libsql-statement-perl libcrypt-des-perl libdigest-hmac-perl libio-socket-inet6-perl mailutils-mh
  mailutils-doc opennms-doc jrrd2 rrdtool postgresql-doc-13 libjson-perl isag
The following NEW packages will be installed:
  exim4-base exim4-config exim4-daemon-light gsasl-common haveged iplike-pgsql13 jicmp jicmp6 libdbd-pg-perl

...

Setting up opennms-webapp-jetty (28.1.1-1) ...
Setting up opennms-source (28.1.1-1) ...
Setting up opennms (28.1.1-1) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u2) ...

The installation package will also install the PostgreSQL server package automatically, we will start it using the following command:

$ sudo systemctl start postgresql
$ sudo systemctl status postgresql
ramansah@otodiginet:~$ sudo systemctl start postgresql
ramansah@otodiginet:~$ sudo systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
     Active: active (exited) since Thu 2021-11-04 08:56:22 EDT; 3min 19s ago
   Main PID: 23847 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4623)
     Memory: 0B
        CPU: 0
     CGroup: /system.slice/postgresql.service

Nov 04 08:56:22 otodiginet systemd[1]: Starting PostgreSQL RDBMS...
Nov 04 08:56:22 otodiginet systemd[1]: Finished PostgreSQL RDBMS.

5. Set up PostgreSQL Database

On this section, we will create a new database on PostgreSQL that we have created. The database and user creation is as follow :

psql -c "ALTER USER opennms WITH PASSWORD 'opennms';"                    -- for creating a new user called as opennms
createdb -O opennms opennms                                                                       -- for creating database caslled as opennms 
psql -c "ALTER USER postgres WITH PASSWORD 'OtodigiPassw0rd';"        -- setting password for postrgres user
ramansah@otodiginet:~$ sudo su - postgres
postgres@otodiginet:~$ createuser opennms
postgres@otodiginet:~$ psql -c "ALTER USER opennms WITH PASSWORD 'opennms';"
ALTER ROLE
postgres@otodiginet:~$ createdb -O opennms opennms
postgres@otodiginet:~$ psql -c "ALTER USER postgres WITH PASSWORD 'OtodigiPassw0rd';"
ALTER ROLE
postgres@otodiginet:~$ exit
logout6. 

Until this step, we have setup PostgreSQL database successfully and then we will continue to initialize the OpenNMS.

6. Initialize and Start OpenNMS Horizon

On this step we will configure the OpenNMS data source by adjusting a file and define database settings. The configuration file is located on /usr/share/opennms/etc/opennms-datasources.xml file. We will use the vi text editor for editing this file.

$ sudo vi /usr/share/opennms/etc/opennms-datasources.xml

The file’s content is as follow :

<?xml version="1.0" encoding="UTF-8"?>
<datasource-configuration xmlns:this="http://xmlns.opennms.org/xsd/config/opennms-datasources"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.opennms.org/xsd/config/opennms-datasources
  http://www.opennms.org/xsd/config/opennms-datasources.xsd ">

  <connection-pool factory="org.opennms.core.db.HikariCPConnectionFactory"
    idleTimeout="600"
    loginTimeout="3"
    minPool="50"
    maxPool="50"
    maxSize="50" />

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

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

Then we will integrate OpenNMS with Java, by running the following command:

$ sudo /usr/share/opennms/bin/runjava -s
ramansah@otodiginet:~$ sudo /usr/share/opennms/bin/runjava -s
runjava: Looking for an appropriate JVM...
runjava: Checking for an appropriate JVM in JAVA_HOME...
runjava: Skipping... JAVA_HOME not set.
runjava: Checking JVM in the PATH: "/etc/alternatives/java"...
runjava: Did not find an appropriate JVM in the PATH: "/etc/alternatives/java"
runjava: Searching for a good JVM...
runjava: Found a good JVM in "/usr/lib/jvm/java-11-openjdk-amd64/bin/java".
runjava: Value of "/usr/lib/jvm/java-11-openjdk-amd64/bin/java" stored in configuration file.

Then we continue to initialize the database and detect system libraries using the following command:

$ sudo /usr/share/opennms/bin/install -dis
ramansah@otodiginet:~$ sudo /usr/share/opennms/bin/install -dis

...

- Running execution phase
  Current configuration: 32 services.
  A service entry named 'OpenNMS:Name=PerspectivePoller' already exists.
  Final configuration: 32 services.
- Saving the execution state
- Running post-execution phase
  Removing backup /usr/share/opennms/etc/service-configuration.xml.zip

Finished in 0 seconds

Upgrade completed successfully!

On this step, the OpenNMS service has been starting up, so we will verify it by querying its service by typing the command line :

$ sudo systemctl status opennms
ramansah@otodiginet:~$ sudo systemctl status opennms
● opennms.service - OpenNMS server
     Loaded: loaded (/lib/systemd/system/opennms.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2021-11-04 09:23:29 EDT; 6min ago
    Process: 838 ExecStart=/usr/share/opennms/bin/opennms -s start (code=exited, status=0/SUCCESS)
   Main PID: 2516 (java)
      Tasks: 327 (limit: 9454)
     Memory: 2.0G
        CPU: 3min 33.928s
     CGroup: /system.slice/opennms.service
             ├─2515 bash /usr/share/opennms/bin/opennms -s start
             └─2516 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-modules=java.base,java.compile>

Nov 04 09:24:11 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-api [org.ops4j.pax.loggi>
Nov 04 09:24:11 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-api [org.ops4j.pax.loggi>
Nov 04 09:24:11 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-api [org.ops4j.pax.loggi>
Nov 04 09:24:11 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-api [org.ops4j.pax.loggi>
Nov 04 09:24:11 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-api [org.ops4j.pax.loggi>
Nov 04 09:24:11 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-api [log4j2] INFO : Init>
Nov 04 09:24:12 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-api [log4j2] INFO : Scan>
Nov 04 09:24:12 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-api [log4j2] INFO : Log4>
Nov 04 09:24:12 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-log4j2 [org.ops4j.pax.lo>
Nov 04 09:24:12 otodiginet opennms[2516]: org.ops4j.pax.logging.pax-logging-api [log4j2] INFO : Log4>

7. Configure Firewall Using ufw

OpenNMS is using default port on port 8980, we will verify it by using command line.

$ ss -antpl | grep 8980

If our OpenNMS is running on an active firewall, we need to allow the port as shown below :

$ sudo ufw allow 8980/tcp
$ sudo ufw reload
$ sudo ufw enable
$ sudo ufw reload
ramansah@otodiginet:~$ sudo ufw allow 8980/tcp
Rules updated
Rules updated (v6)
ramansah@otodiginet:~$ sudo ufw reload
Firewall not enabled (skipping reload)
ramansah@otodiginet:~$ sudo ufw enable
Firewall is active and enabled on system startup
ramansah@otodiginet:~$ sudo ufw reload
Firewall reloaded

8. Accessing OpenNMS Horizon

To access OpenNMS Horizon, we will use our web browser and access the OpenNMS web console using the URL http://server-ip:8980/opennms, as shwon below for OpenNMS login page:

OpenNMS login page
OpenNMS login page
OpenNMS first page
OpenNMS first page

The OpenNMS Horizon montiroing system has been installed and running successfully on Debian 11 (Bulleyes) operating system.

Conclusion

On this article we have shown you how to install OpenNMS Horizon version 28 successfully.I hope this article will be useful for anyone who is looking for the way to install opennms on a debian 11 operating system. More details about OpenNMS can be found on the OpenNMS official website.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *