Install and Configure OpenNMS on AlmaLinux 8

In this guide, we want to show you to Install and Configure OpenNMS Horizon on AlmaLinux 8.

OpenNMS is an enterprise-grade network monitoring and network management platform developed under the free software or open-source model. It was designed to manage tens of thousands of devices from a single server as well as manage unlimited devices using a cluster of servers. 

OpenNMS 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. 

As a network platform, it provides several major feature categories:

  • Discovery – finding out what equipment is on your network, and adding it to the database
  • Monitoring – keeping track of the status of the networked equipment
  • Events – receiving, correlating, and sending notifications
  •  Data Collection – collection, storage, and reporting of various network-available data points

OpenNMS is made up of the following components:

  • OpenNMS Horizon with:
    • Core (server that drives Horizon)
    • Minion (distritubed monitoring)
    • Sentinel (scalability)
  • Helm (customized dashboards)
  • Architecture for Learning Enabled Correlation (ALEC) (alarm triage)
  • Provisioning Integration Server (PRIS) (extracted data integration)

Steps To Install and Configure OpenNMS on AlmaLinux 8

To complete this guide, you must 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 AlmaLinux 8.

Install Java on AlmaLinux 8

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

sudo dnf update -y

Then, install the required packages by using the command below:

sudo dnf install vim  curl wget -y

Now use the command below to install Java on AlmaLinx 8:

sudo dnf install java-11-openjdk-devel -y

Verify your Java installation by checking its version:

java -version
Output
openjdk version "11.0.18" 2023-01-17 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.18.0.10-2.el8_7) (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.18.0.10-2.el8_7) (build 11.0.18+10-LTS, mixed mode, sharing)

Set up OpenNMS on AlmaLinux 8

The OpenNMS packages aren’t available in the default AlmaLinux 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:

sudo rpm --import https://yum.opennms.org/OPENNMS-GPG-KEY

Add OpenNMS Repository

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

sudo dnf install https://yum.opennms.org/repofiles/opennms-repo-stable-rhel8.noarch.rpm -y

Install OpenNMS on AlmaLinux

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

sudo dnf install opennms -y

This will install all the dependencies on your server.

Configure PostgreSQL for OpenNMS on AlmaLinux 8

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

First, you need to initialize the PostgreSQL by using the following command:

sudo postgresql-setup --initdb --unit postgresql
Output
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

Then, start and enable the PostgreSQL service with the following commands:

# sudo systemctl enable postgresql
# sudo systemctl start postgresql

Verify your PostgreSQL is active and running on AlmaLinux 8:

sudo systemctl status postgresql
Output
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor >
   Active: active (running) since Wed 2023-02-22 05:48:49 EST; 11s ago
  Process: 50800 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (>
 Main PID: 50803 (postmaster)
    Tasks: 8 (limit: 23668)
   Memory: 15.9M
   CGroup: /system.slice/postgresql.service
...

Next, switch to your PostgreSQL user:

sudo -i -u 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 AlmaLinux 8 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

Modify PostgreSQL Access Policy

At this point, you need to open the following file to modify the PostgreSQL access policy:

sudo vi /var/lib/pgsql/data/pg_hba.conf

Find the lines below and modify them by replacing ident with MD5:

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

# IPv6 local connections:
host    all             all             ::1/128                 md5

When you are done, save and close the file.

To apply the changes, restart PostgreSQL:

sudo systemctl restart postgresql

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 vi:

sudo vi /opt/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 AlmaLinux 8

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

sudo /opt/opennms/bin/runjava -s
Output
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: "/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-2.el8_7.x86_64/bin/java"...
runjava: Found an appropriate JVM in the PATH: "/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-2.el8_7.x86_64/bin/java"
runjava: Value of "/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-2.el8_7.x86_64/bin/java" stored in configuration file.

Next, initialize the database and detect system libraries in the /opt/opennms/etc/libraries.properties directory:

sudo /opt/opennms/bin/install -dis

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

# sudo dnf install chkconfig -y 
# sudo systemctl enable --now opennms

Verify your OpenNMS service is active and running on AlmaLinux 8:

sudo systemctl status opennms
Output
● opennms.service - OpenNMS server
   Loaded: loaded (/usr/lib/systemd/system/opennms.service; enabled; vendor pre>
   Active: active (running) since Wed 2023-02-22 07:05:53 EST; 37s ago
  Process: 53790 ExecStartPost=/bin/sleep 3 (code=exited, status=0/SUCCESS)
  Process: 52798 ExecStart=/opt/opennms/bin/opennms -s start (code=exited, stat>
 Main PID: 53791 (java)
    Tasks: 83 (limit: 23668)
   Memory: 785.2M
   CGroup: /system.slice/opennms.service
           ├─53789 bash /opt/opennms/bin/opennms -s start
           └─53791 /usr/lib/jvm/java-11-openjdk-11.0.18.0.10-2.el8_7.x86_64/bin

Configure Firewall For OpenNMS

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

sudo firewall-cmd --permanent --add-port=8980/tcp

Reload the firewall to apply the changes:

sudo firewall-cmd --reload

If your SELinux is enabled on your server, you have to allow the port through SELinux:

sudo semanage port -a -t http_port_t -p tcp 8980

Access OpenNMS Web Interface

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

http://IP_Address: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 dashboard on AlmaLinux 8.

OpenNMS Dashboard AlmaLinux 8
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 requisition, IP Address, and Node Label, and click Provision.

OpenNMS Node Credentials
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 ALmaLinux 8
Monitor Devices

For more information, you can visit OpenNMS Documentation.

Conclusion

At this point, you have learned to Install and Configure OpenNMS Horizon on AlmaLinux 8.

Hope you enjoy it. You may be like these articles:

How To Install PHP 7.4 on AlmaLinux 8

Install and Configure Postfix Mail Server on AlmaLinux 8

Install and Configure Nextcloud on AlmaLinux 8

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!