Install OpenNMS Network Monitoring in Debian and Ubuntu
OpenNMS (Open Network Management System) is a free and open source, scalable, extensible, enterprise-grade and cross-platform Java-based network management platform was designed to monitor critical services on remote machines and gathers the information of remote hosts data by using SNMP and JMX (Java Management Extensions).
OpenNMS runs on Linux and Windows operating systems and comes with a web-based console for easily administering networks and applications, supported by a Postgres database management system in the backend.
- Debian 9 or higher, Ubuntu 16.04 LTS or higher
- Installed OpenJDK 11 Development Kit
- 2 CPU, 2 GB RAM, 20 GB disk
In this article, we will explain how to install and setup the latest OpenNMS Horizon network service monitoring software in Debian and Ubuntu Linux distributions.
Step1: Installing Java – OpenJDK 11 in Ubuntu
First, install the most recent version of OpenJDK Java 11 using the following apt command.
$ sudo apt-get install openjdk-11-jdk
Next, verify the version of Java installed on your system.
$ java -version
Then set the Java environment variable for all users on boot time, by adding the following line in /etc/profile file.
save the file and run the following command to read /etc/profile file.
$ source /etc/profile
Step 2: Install OpenNMS Horizon in Ubuntu
To install OpenNMS Horizon, add the apt repository in
/etc/apt/sources.list.d/opennms.list and add GPG key, then update the APT cache using the following commands.
$ 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 $ wget -O - https://debian.opennms.org/OPENNMS-GPG-KEY | apt-key add - $ apt update
Next, install OpenNMS Horizon meta-packages (opennms-core and opennms-webapp-jetty) with all built-in dependencies (jicmp6 and jicmp, postgresql and postgresql-libs).
$ sudo apt install opennms
Then verify that the OpenNMS meta packages have been installed in the
/usr/share/opennms directory using the tree utility.
$ cd /usr/share/opennms $ tree -L 1
Note: It is recommended to disable the OpenNMS Horizon apt repository after installation to prevent upgrades while it is running:
$ sudo apt-mark hold libopennms-java libopennmsdeps-java opennms-common opennms-db
Step 3: Initialize and Setup PostgreSQL
On Debian and Ubuntu, immediately after installing the packages, the installer initializes Postgres database, starts the service and enables it to auto-start at system boot.
To check if the service is up and running, run the following command:
$ sudo systemctl status postgresql
Next, switch to the postgres user account and create an opennms database user with a password.
$ sudo su - postgres $ createuser -P opennms $ createdb -O opennms opennms
Now secure the postgres default/superuser account by setting a password.
$ psql -c "ALTER USER postgres WITH PASSWORD 'YOUR-POSTGRES-PASSWORD';"
At this stage, you need to set up the database access in OpenNMS Horizon configuration file.
$ sudo vim /usr/share/opennms/etc/opennms-datasources.xml
Find the sections below and set credentials to access the PostgreSQL database:
<jdbc-data-source name="opennms" database-name="opennms" class-name="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/opennms" user-name="opennms-db-username" password="opennms-db-user-passwd” /> <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-super-user-passwd" />
Save the changes in the file and close it.
Step 4: Initialize and start OpenNMS Horizon
To initialize OpenNMS, you need to intergrate it with Java. So, run the following command to detect the Java environment and persist in /usr/share/opennms/etc/java.conf configuration file.
$ sudo /usr/share/opennms/bin/runjava -s
Next, you need to initialize the database and detect system libraries persisted in
/opt/opennms/etc/libraries.properties by running the OpenNMS installer.
$ sudo /usr/share/opennms/bin/install -dis
Now start OpenNMS service via systemd for now, then enable it to auto-start at system startup and check its status with these commands.
$ sudo systemctl start opennms $ sudo systemctl enable opennms $ sudo systemctl status opennms
If you have a UFW firewall running on your system, you need to open the port 8980 in your firewall.
$ sudo ufw allow 8980/tcp $ sudo ufw reload
Step 5: Access OpenNMS Web Console and Login
Now open a web browser and point it to the following URL to access the OpenNMS web console.
http://SERVER_IP:8980/opennms OR http://FDQN-OF-YOUR-SERVER:8980/opennms
After the login interface shows up as shown in the following image, use the default login credentials: username is admin and the password is admin.
Once you have successfully logged on for the first time, you will access the admin dashboard.
Next, you need to change the default admin password by going to the main navigation menu, click “admin → Change Password, under User Account Self-Service, click “Change Password“.
Enter the current/default password, set a new password and confirm it, then Click “Submit“. Afterwards logout and login with your new password.
Finally, learn how to set up, configure, and maintain an OpenNMS Horizon via the web interface, add nodes and application by consulting the OpenNMS Administrators Guide.
OpenNMS is an enterprise-grade network and application monitoring tool. As usual, reach us through the feedback form below for any questions or comments about this article.