How To Set up OpenNMS on Debian 11

In this guide, we want to teach you to Set up (Install and Configure) OpenNMS Horizon on Debian 11.

OpenNMS provides a highly reliable, scalable, and comprehensive fault, performance, and traffic monitoring solution that easily integrates with business applications and workflows to monitor and visualize everything in a network. The OpenNMS platform monitors some of the largest networks in existence, covering the healthcare, technology, finance, government, education, retail, and industrial sectors, many with tens of thousands of networked devices.

There are two types of OpenNMS – Meridian and Horizon. When we need stability and long-term support, choose Meridian, which is best for enterprises and businesses. Horizon is used where innovation occurs frequently. It is best for IT-ecosystem, and new technologies monitoring.

Steps To Install and Configure OpenNMS on Debian 11

To complete this guide, log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our guide on Initial Server Setup with Debian 11.

Install Java on Debian 11

Because OpenNMS is written in Java, you must install Java on your server. First, run the system update:

sudo apt update

Now use the command below to install Java on Debian 11:

sudo apt install default-jdk -y

Verify your Java installation by checking its version:

java -version
Output
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.18+10-post-Debian-1deb11u1, mixed mode, sharing)

Set Java Environment Variables

At this point, you need to set the Java home path by using the command below:

sudo export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64

Then, source the /etc/profile file:

sudo source /etc/profile

Set up OpenNMS Horizon on Debian 11

The OpenNMS packages aren’t available in the default Debian repository. So you need to add it manually.

Import OpenNMS GPG Key

At this point, you need to use the following command to import the OpenNMS GPG key:

wget -O - https://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -

Add OpenNMS Repository

Then, you need to add the OpenNMS repo to your server by using the command below:

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

Install OpenNMS on Debian

Now you can easily use the command below to install OpenNMS:

# sudo apt update
# sudo apt -y install opennms

This will install all the dependencies on your server.

Configure PostgreSQL for OpenNMS on Debian 11

When your dependencies and OpenNMS are installed on your server, you need to configure PostgreSQL.

First, verify your PostgreSQL is active and running on Debian 11:

sudo systemctl status postgresql
Output
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor pr>
     Active: active (exited) since Mon 2023-03-06 13:35:35 EST; 54s ago
   Main PID: 7704 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4679)
     Memory: 0B
        CPU: 0
     CGroup: /system.slice/postgresql.service
...

Next, switch to your PostgreSQL user:

sudo su - postgres

Create OpenNMS Database and User

At this point, use the following command to create an OpenNMS user:

createuser -P opennms
Enter password for new role: 
Enter it again: 

Then, create the OpenNMS database on Debian 11 by using the command below:

createdb -O opennms opennms

Next, protect the default user with a password:

psql -c "ALTER USER postgres WITH PASSWORD 'StrongPassword';"
Output
ALTER ROLE

Exit the PostgreSQL shell:

[postgres@localhost ~]$ exit

Define database credentials in OpenNMS Config File

At this point, you need to define the database credentials in the OpenNMS config file. Open the file with your favorite text editor, here we use the vi editor:

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

Find the lines below and define your database credentials:

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

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

When you are done, save and close the file.

Manage OpenNMS Service on Debian 11

First, you need to initialize OpenNMS by adding the Java settings:

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

Next, initialize the database and detect system libraries in the /usr/share/opennms/bin/install directory:

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

At this point, you can use the following commands to start and enable your OpenNMS service:

# sudo systemctl start opennms
# sudo systemctl enable opennms

Verify your OpenNMS service is active and running on Debian 11:

sudo systemctl status opennms
Output
● opennms.service - OpenNMS server
     Loaded: loaded (/lib/systemd/system/opennms.service; enabled; vendor prese>
     Active: active (running) since Mon 2023-03-06 13:42:29 EST; 10s ago
   Main PID: 12875 (java)
      Tasks: 130 (limit: 4679)
     Memory: 446.2M
        CPU: 34.477s
     CGroup: /system.slice/opennms.service
             ├─12874 bash /usr/share/opennms/bin/opennms -s start
             └─12875 /usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java --add-modu>
...

Configure Firewall For OpenNMS

Here we assumed that you have enabled UFW. By default, OpenNMS is listening on port 8980. You have to allow this port through the firewall using the following command:

sudo ufw allow 8980/tcp

Reload the firewall to apply the changes:

sudo ufw reload

Access OpenNMS Web Interface

At this point, you can access OpenNMS Horizon through the Web interface on Debian 11 by typing your server’s IP address in your web browser followed by 8980/opennms:

http://your-server-ip:8980/opennms

You will see the OpenNMS horizon login screen. Enter admin as the username and password and click Login.

OpenNMS Login
OpenNMS Login

Then, you should see the OpenNMS Horizon dashboard on Debian 11.

OpenNMS Dashboard Ubuntu 22.04
OpenNMS Dashboard

You can now change the password to a preferred one by navigating to admin → Change Password.

Change default Admin Password OpenNMS
Change default Admin Password
Add New Admin Password for OpenNMS
Add New Admin Password

How To Monitor Systems with OpenNMS

To be able to monitor systems, you need to add them to OpenNMS. Begin by clicking on the “+“ icon as shown below.

Add node to OpenNMS
Add node

Enter the required details such as requisitionIP Address, and Node Label, and click Provision.

OpenNMS Node Credentials Debian 11
Node Credentials

After the node has been added, it will appear under Info → Nodes.

You can now view graphs and create alerts for the device.

Monitor Devices with OpenNMS Debian 11
Monitor Devices

For more information, you can visit OpenNMS Documentation.

Conclusion

At this point, you have learned to Set up (Install and Configure) OpenNMS Horizon on Debian 11.

Hope you enjoy it. You may be like these articles on the Orcacore website:

How To Install OpenSSL 3 on Debian 11

Install and Use Yarn on Debian 11

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

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

Stay informed and not overwhelmed, subscribe now!