Skip to content
CMS

How to Install OpenNMS on Ubuntu 24.04

Richard
Written by
Richard
Feb 18, 2025 Updated Mar 20, 2026 5 min read
How to Install OpenNMS on Ubuntu 24.04

You install OpenNMS on Ubuntu 24.04 by executing a series of terminal commands to configure the network management system.

OpenNMS is an open-source platform that helps you monitor network performance, detect issues, and manage network assets.

This process involves setting up the necessary repositories and installing the OpenNMS package, typically version Horizon.

You’ll configure its core components directly within the Ubuntu 24.04 command line.

⚡ Quick Answer

Install OpenNMS by first setting up PostgreSQL, then downloading and adding the OpenNMS repository. Finally, install the OpenNMS packages using apt install opennms. Configure database access with scvcli and update opennms-datasources.xml.

Install PostgreSQL

To install PostgreSQL, which OpenNMS needs to store its data, open your terminal and run the command: sudo apt install postgresql. This step sets up the necessary database system for your OpenNMS installation.

Run the command below to install it.

🐧Bash / Shell
sudo apt install postgresql

After installing PostgreSQL, run the command below to create a database user account called ‘opennms‘ for PostgreSQL.

When prompted, type a secure password for the opennms database account.

🐧Bash / Shell
sudo -u postgres createuser -P opennms

Next, run the command below to create an empty database called ‘opennms‘ and set the owner to the opennms user account created above.

🐧Bash / Shell
sudo -u postgres createdb -O opennms opennms

Finally, run the command below to set the PostgreSQL superuser password.

🐧Bash / Shell
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'type_your_password';"

Replace ‘type_your_password‘ with your secure password.

Download and configure OpenNMS.

Now that Java and PostgreSQL are ready, it’s time to download and set up OpenNMS. First, add the OpenNMS repository’s security key by running this command in your terminal: curl -fsSL https://debian.opennms.org/OPENNMS-GPG-KEY | sudo gpg –dearmor -o /usr/share/keyrings/opennms.gpg.

But first, add the openNMS repository GPG key by running the command below.

💻Code
curl -fsSL https://debian.opennms.org/OPENNMS-GPG-KEY | sudo gpg --dearmor -o /usr/share/keyrings/opennms.gpg

Next, add the openNMS repository file.

Command Prompt
echo "deb [signed-by=/usr/share/keyrings/opennms.gpg] https://debian.opennms.org stable main" | sudo tee /etc/apt/sources.list.d/opennms.list

Finally, run the commands below to install OpenNMS packages, including all dependencies.

🐧Bash / Shell
sudo apt update
sudo apt install opennms
sudo apt install r-recommended

The command above will install Java JDK since OpenNMS depends on it.

Run the command below to see which version of Java JDK has been installed. At the time of this writing, Java JDK version 11 will be installed when you install the OpenNMS packages.

🐧Bash / Shell
sudo update-alternatives --config java

Take notice of the version and path. Then, continue below to set your JAVA_HOME variable.

Next, run the command below to open the /etc/environment file.

🐧Bash / Shell
sudo nano /etc/environment

Then, add the Java path displayed above at the end of the file and save.

💻Code
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

Next, run the command below to apply the changes.

💻Code
source /etc/environment

When you’re done, OpenJDK should be installed and ready to use.

Configure PostgreSQL database access

To connect OpenNMS to your PostgreSQL database securely, you’ll store your login details in a special vault. Use the scvcli command to add your PostgreSQL username and password, like this: sudo -u opennms /usr/share/opennms/bin/scvcli set postgres opennms type_your_password.

🐧Bash / Shell
sudo -u opennms /usr/share/opennms/bin/scvcli set postgres opennms type_your_password 
sudo -u opennms /usr/share/opennms/bin/scvcli set postgres-admin postgres type_your_password
Replace both type_your_password instances with the actual passwords for your opennms and postgres database accounts.

Next, run the command below to open the opennms-datasources.xml file.

🐧Bash / Shell
sudo -u opennms nano /usr/share/opennms/etc/opennms-datasources.xml

Set encrypted credentials to access the PostgreSQL database in the file below.

You shouldn’t have to do anything in the file since the encrypted credentials variables are used in the configuration.

This is how the file should look.

🎨CSS
...
<jdbc-data-source name="opennms"
database-name="opennms"
class-name="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/opennms"
user-name="${scv:postgres:username}"
password="${scv:postgres:password}" />

<jdbc-data-source name="opennms-admin"
database-name="template1"
class-name="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/template1"
user-name="${scv:postgres-admin:username}"
password="${scv:postgres-admin:password}">
<connection-pool idleTimeout="600"
minPool="0"
maxPool="10"
maxSize="50" />
</jdbc-data-source>

<jdbc-data-source name="opennms-monitor"
database-name="postgres"
class-name="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres"
user-name="${scv:postgres-admin:username}"
password="${scv:postgres-admin:password}">
<connection-pool idleTimeout="600"
minPool="0"
maxPool="10"
maxSize="50" />
...

Save and exit.

Detect the Java environment and persist in /usr/share/opennms/etc/java.conf

🐧Bash / Shell
sudo /usr/share/opennms/bin/runjava -s

You should see the output below:

💻Code
Output:
runjava: Looking for an appropriate JVM...
runjava: Checking for an appropriate JVM in JAVA_HOME...
runjava: Found: "/usr/lib/jvm/java-11-openjdk-amd64/bin/java" is an appropriate JVM.
runjava: Value of "/usr/lib/jvm/java-11-openjdk-amd64/bin/java" stored in configuration file.

If you are getting an error starting OpenNMS, manually add the JAVA_HOME settings using the commands below:

🐧Bash / Shell
sudo nano /etc/default/opennms

Then add the highlighted line in the file and save

💻Code
# Set JAVA_HOME if it cannot be auto-detected
#JAVA_HOME=/usr/lib/jvm/java-8-oracle

JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64

Initialize the database and detect system libraries persisted in /opt/opennms/etc/libraries.properties

🐧Bash / Shell
sudo /usr/share/opennms/bin/install -dis

You should see an output with a success message.

Next, configure the system’s service for OpenNMS to start Horizon on the system boot.

🐧Bash / Shell
sudo systemctl enable --now opennms
sudo systemctl start opennms

Finally, the OpenNMS web application at the URL below.

http://localhost:8980/opennms

The default login user is admin, and the password is initialized to admin.

Username: admin
Password: admin

OpenNMS login portal

Log in and start configuring your settings.

OpenNMS login admin
OpenNMS login admin

That should do it!

Conclusion:

This guide covered the essential steps to install OpenNMS on Ubuntu 24.04 successfully. Here’s a quick recap:

  • OpenNMS Installation: Followed the installation process for OpenNMS to enable robust network management capabilities.
  • PostgreSQL Setup: Installed and configured PostgreSQL, creating a dedicated database user and setting up the necessary databases.
  • Java Configuration: Installed Java and configured the JAVA_HOME variable to ensure OpenNMS runs smoothly.
  • Security Measures: Implemented credential storage using the secure credentials vault for PostgreSQL.
  • Service Management: Enabled OpenNMS to start on system boot and initiated the service.
  • Web Access: Gained access to the OpenNMS web interface for further configuration and monitoring.

By completing these steps, you now have a fully functional OpenNMS installation that can help you monitor and manage your network effectively.

Is OpenNMS still free?

OpenNMS is a free and open-source network monitoring and network management platform written in Java. It provides fault management, performance data collection, service monitoring, event processing, and topology mapping.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

No comments yet — be the first to share your thoughts!

Leave a Comment

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

Exit mobile version