Install OpenNMS on Rocky Linux 8: Easy And Full Setup
This tutorial will guide you through the process of installing Install OpenNMS on Rocky Linux 8. OpenNMS is a robust, enterprise-grade, integrated, and open-source platform designed for building comprehensive network monitoring solutions. Its primary goals include accelerating the time to production by natively supporting industry-standard network management protocols, agents, and a programmable provisioning system. It also enables the efficient sending of alerts to on-call system engineers through various implemented notification strategies. Furthermore, the platform’s capabilities can be extended using its native Java API or by running scripts directly on the underlying operating system.
The OpenNMS platform provides numerous avenues for forwarding monitoring information, facilitating seamless integration with existing management workflows. To successfully complete the OpenNMS configuration on Rocky Linux 8, meticulously follow the steps detailed below, provided by Orcacore.
Steps To Install and Configure OpenNMS on Rocky Linux 8
Before starting the OpenNMS configuration on Rocky Linux 8, ensure you are logged into your server as a non-root user with sudo privileges and that a basic firewall is set up. You can refer to the guide on Initial Server Setup with Rocky Linux 8 for assistance.
1. Install Java on Rocky Linux 8
Since OpenNMS is written in Java, a Java Development Kit (JDK) is a prerequisite. First, update your system:
sudo dnf update -y
Then, install essential packages using the following command:
sudo dnf install vim curl wget -y
Install Java 11 using the following command:
sudo dnf install java-11-openjdk-devel -y
Verify the Java installation by checking the 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)
2. Set up OpenNMS on Rocky Linux 8
OpenNMS packages aren’t available in the default Rocky Linux repositories. Therefore, you must add the OpenNMS repository manually.
Import OpenNMS GPG Key
Import the OpenNMS GPG key using the following command:
sudo rpm --import https://yum.opennms.org/OPENNMS-GPG-KEY
Add OpenNMS Repository
Add the OpenNMS repository to your server using the command below:
sudo dnf install https://yum.opennms.org/repofiles/opennms-repo-stable-rhel8.noarch.rpm -y
Install OpenNMS on Rocky Linux 8
Now, install OpenNMS with:
sudo dnf install opennms -y
This command installs OpenNMS and all its necessary dependencies.
3. PostgreSQL Setup for OpenNMS Configuration
After installing OpenNMS and its dependencies, configure PostgreSQL, the recommended database for OpenNMS.
First, initialize the PostgreSQL database using:
sudo postgresql-setup --initdb --unit postgresql
**Output**
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
Start and enable the PostgreSQL service:
# sudo systemctl enable postgresql
# sudo systemctl start postgresql
Verify that PostgreSQL is active and running:
sudo systemctl status postgresql
**Output**
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor >
Active: **active** (**running**) since Sat 2023-03-04 05:16:23 EST; 5s ago
Process: 92932 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (>
Main PID: 92935 (postmaster)
Tasks: 8 (limit: 23699)
Memory: 15.8M
CGroup: /system.slice/postgresql.service
└─92935 /usr/bin/postmaster -D /var/lib/pgsql/data
...
Switch to the PostgreSQL user:
sudo -i -u postgres
Create OpenNMS Database and User
Create an OpenNMS user:
createuser -P opennms
Enter password for new role:
Enter it again:
Create the OpenNMS database:
createdb -O opennms opennms
Next, protect the default postgres
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
Modify the PostgreSQL access policy by editing the pg_hba.conf
file:
sudo vi /var/lib/pgsql/data/pg_hba.conf
Find these lines and replace ident
with md5
:
# IPv4 local connections:
host all all 127.0.0.1/32 **md5**
# IPv6 local connections:
host all all ::1/128 **md5**
Save the file and restart PostgreSQL:
sudo systemctl restart postgresql
Define database credentials in OpenNMS Configuration File
Define the database credentials in /opt/opennms/etc/opennms-datasources.xml
:
sudo vi /opt/opennms/etc/opennms-datasources.xml
Find the following lines and update the 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" />
Save and close the file.
4. Manage OpenNMS Service on Rocky Linux 8
First, 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:
sudo /opt/opennms/bin/install -dis
Start and enable the OpenNMS service:
# sudo dnf install chkconfig -y
# sudo systemctl enable --now opennms
Verify that OpenNMS is active and running:
sudo systemctl status opennms
**Output**
Loaded: loaded (/usr/lib/systemd/system/opennms.service; enabled; vendor pre>
Active: **active** (**running**) since Sat 2023-03-04 05:21:06 EST; 4s ago
Process: 94430 ExecStartPost=/bin/sleep 3 (code=exited, status=0/SUCCESS)
Process: 93439 ExecStart=/opt/opennms/bin/opennms -s start (code=exited, stat>
Main PID: 94429 (java)
Tasks: 44 (limit: 23699)
Memory: 324.8M
...
5. Configure Firewall For OpenNMS
Assuming firewalld
is enabled, allow port 8980
through the firewall:
sudo firewall-cmd --permanent --add-port=8980/tcp
Reload the firewall:
sudo firewall-cmd --reload
If SELinux is enabled, allow the port:
sudo semanage port -a -t http_port_t -p tcp 8980
6. Access OpenNMS Web Interface
Access the OpenNMS Horizon web interface by navigating to your server’s IP address followed by :8980/opennms
:
http://<server-ip>:8980/opennms
Log in with the default username admin
and password admin
.

You should now see the OpenNMS dashboard.
Change the default password by navigating to admin -> Change Password.
7. How To Monitor Systems with OpenNMS?
Add systems to OpenNMS for monitoring by clicking the "+" icon.
Enter the required details (requisition, IP address, node label) and click "Provision".
After adding the node, it will appear under Info -> Nodes.
You can now view graphs and create alerts for the device.
For more detailed information, consult the OpenNMS Documentation.
Conclusion
You have now successfully learned how to Install OpenNMS on Rocky Linux 8. OpenNMS is a powerful tool for collecting and analyzing data from network devices, providing valuable insights into network performance and health. With Install OpenNMS on Rocky Linux 8, you can proactively manage your network and address potential issues before they impact your users. The detailed guide to Install OpenNMS on Rocky Linux 8 above provides a solid foundation for setting up your network monitoring solution.
Install OpenNMS on Rocky Linux 8 is a great solution! Here are some other articles you might find interesting:
- How To Install PHP 8.2 on Rocky Linux 8
- Set up Python 3.11 on Rocky Linux 8
- Resolve semanage command Not Found Error on Rocky Linux
- Set up OpenJDK 19 on Rocky Linux 8
- Apache Web Server Setup Rocky Linux 9
Alternative Solutions for Network Monitoring on Rocky Linux 8
While OpenNMS is a solid choice for network monitoring, other solutions can be implemented on Rocky Linux 8, each with its strengths and weaknesses. Here are two alternatives:
1. Using Zabbix
Zabbix is another popular open-source monitoring solution offering similar functionalities to OpenNMS. However, it has a different architecture and configuration approach.
Explanation:
Zabbix uses agents installed on monitored hosts to collect data, or it can monitor network devices directly via SNMP, SSH, or other protocols. It offers a web-based interface for configuration, data visualization, and alert management. Zabbix is known for its ease of use, scalability, and comprehensive feature set.
Steps for Installing Zabbix on Rocky Linux 8:
-
Install the Zabbix Repository:
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm dnf clean all
-
Install Zabbix Server, Frontend, and Agent:
dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-agent
-
Install PHP Modules (required by the Zabbix web frontend):
dnf install php php-fpm php-mysqlnd php-gd php-ldap php-mbstring php-xml
-
Create a Database for Zabbix:
sudo -i -u postgres createuser -P zabbix createdb -O zabbix zabbix exit
-
Import Initial Schema and Data:
zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix
-
Configure Zabbix Server: Edit
/etc/zabbix/zabbix_server.conf
and set the database details:DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=your_zabbix_password
-
Configure PHP: Edit
/etc/php-fpm.d/zabbix.conf
and uncomment/modify thephp_value
directives to match Zabbix’s requirements:php_value[post_max_size] = 16M php_value[upload_max_filesize] = 2M php_value[max_execution_time] = 300 php_value[max_input_time] = 300 php_value[date.timezone] = America/Los_Angeles #Replace with your timezone
-
Start and Enable Zabbix Server, Agent, and PHP-FPM:
systemctl enable zabbix-server zabbix-agent php-fpm systemctl start zabbix-server zabbix-agent php-fpm
-
Configure Firewall:
firewall-cmd --permanent --add-port={80/tcp,10051/tcp} firewall-cmd --reload
-
Access the Zabbix Web Interface: Open your web browser and navigate to
http://<server-ip>/zabbix
. The default username isAdmin
and the password iszabbix
.
2. Using Prometheus and Grafana
Prometheus is an open-source systems monitoring and alerting toolkit initially built at SoundCloud. Grafana is an open-source data visualization and monitoring suite. They often work together.
Explanation:
Prometheus excels at collecting and storing time-series data. It uses a pull model, where it scrapes metrics from exposed endpoints on monitored systems. Grafana then connects to Prometheus as a data source and provides rich dashboards and visualizations of the collected metrics. This combination is highly flexible and scalable, especially suitable for dynamic environments and containerized applications.
Steps for Installing Prometheus and Grafana on Rocky Linux 8:
-
Create User and Directories for Prometheus:
sudo groupadd prometheus sudo useradd -g prometheus --no-create-home --shell /bin/false prometheus sudo mkdir /etc/prometheus sudo mkdir /var/lib/prometheus sudo chown prometheus:prometheus /etc/prometheus sudo chown prometheus:prometheus /var/lib/prometheus
-
Download and Extract Prometheus:
wget https://github.com/prometheus/prometheus/releases/download/v2.45.0/prometheus-2.45.0.linux-amd64.tar.gz tar xvf prometheus-2.45.0.linux-amd64.tar.gz sudo mv prometheus-2.45.0.linux-amd64/prometheus /usr/local/bin/ sudo mv prometheus-2.45.0.linux-amd64/promtool /usr/local/bin/ sudo chown prometheus:prometheus /usr/local/bin/prometheus /usr/local/bin/promtool sudo mv prometheus-2.45.0.linux-amd64/consoles /etc/prometheus sudo mv prometheus-2.45.0.linux-amd64/console_libraries /etc/prometheus sudo chown -R prometheus:prometheus /etc/prometheus/consoles sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
-
Configure Prometheus: Create a
prometheus.yml
file in/etc/prometheus
:sudo vi /etc/prometheus/prometheus.yml
Example
prometheus.yml
:global: scrape_interval: 15s evaluation_interval: 15s scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090']
Ensure the file is owned by the
prometheus
user:sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
-
Create Systemd Service File for Prometheus:
cat <<EOF | sudo tee /etc/systemd/system/prometheus.service [Unit] Description=Prometheus Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/ --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries [Install] WantedBy=multi-user.target EOF
-
Start and Enable Prometheus:
sudo systemctl daemon-reload sudo systemctl enable prometheus sudo systemctl start prometheus sudo systemctl status prometheus
-
Install Grafana:
cat <<EOF | sudo tee /etc/yum.repos.d/grafana.repo [grafana] name=grafana baseurl=https://rpm.grafana.com repo_gpgcheck=1 enabled=1 gpgcheck=1 gpgkey=https://rpm.grafana.com/gpg.key sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt EOF sudo dnf install grafana
-
Start and Enable Grafana:
sudo systemctl enable grafana-server sudo systemctl start grafana-server sudo systemctl status grafana-server
-
Configure Firewall:
sudo firewall-cmd --permanent --add-port={9090/tcp,3000/tcp} sudo firewall-cmd --reload
-
Access Grafana: Open your web browser and navigate to
http://<server-ip>:3000
. The default username isadmin
and the password isadmin
. You will be prompted to change the password. Add Prometheus as a data source in Grafana using the addresshttp://localhost:9090
.
These alternative solutions provide different approaches to network monitoring on Rocky Linux 8, offering flexibility in choosing the best tool based on specific requirements and infrastructure.