{"id":7718,"date":"2021-01-20T23:51:16","date_gmt":"2021-01-20T20:51:16","guid":{"rendered":"https:\/\/kifarunix.com\/?p=7718"},"modified":"2024-03-19T20:47:00","modified_gmt":"2024-03-19T17:47:00","slug":"install-opennms-network-monitoring-tool-on-ubuntu","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-opennms-network-monitoring-tool-on-ubuntu\/","title":{"rendered":"Install OpenNMS Network Monitoring tool on Ubuntu 20.04"},"content":{"rendered":"\n

Follow through the guide to install OpenNMS network monitoring tool on Ubuntu 20.04. OpenNMS<\/a> is an open-source and enterprise grade network monitoring and management solution.<\/p>\n\n\n\n

Read about the capabilities of OpenNMS on OpenNMS platform page<\/a>.<\/p>\n\n\n\n

Installing OpenNMS on Ubuntu 20.04<\/h2>\n\n\n\n

In order to install OpenNMS on Ubuntu 20.04;<\/p>\n\n\n\n

Install OpenJDK 11 Development Kit on Ubuntu 20.04<\/h3>\n\n\n\n

Install Java 11 on Ubuntu 20.04;<\/p>\n\n\n\n

apt update<\/code><\/pre>\n\n\n\n
apt install default-jdk<\/code><\/pre>\n\n\n\n

The command above installs OpenJDK 11 by default on Ubuntu 20.04, as of this writing.<\/p>\n\n\n\n

You can confirm the version of installed Java on Ubuntu by running the command;<\/p>\n\n\n\n

java -version<\/code><\/pre>\n\n\n\n
openjdk version \"11.0.9.1\" 2020-11-04\nOpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)\nOpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)<\/code><\/pre>\n\n\n\n

Install OpenNMS Ubuntu 20.04<\/h3>\n\n\n\n

Once JDK 11 is installed, you can proceed to install OpenNMS on Ubuntu 20.04;<\/p>\n\n\n\n

Create APT repository for the latest OpenNMS stable release version Ubuntu 20.04. You can get the latest version number from the latest release page<\/a>.<\/p>\n\n\n\n

cat << 'EOF' > \/etc\/apt\/sources.list.d\/opennms.list\ndeb https:\/\/debian.opennms.org opennms-27 main\ndeb-src https:\/\/debian.opennms.org opennms-27 main\nEOF<\/code><\/pre>\n\n\n\n

Install OpenNMS APT repo GPG signing key;<\/p>\n\n\n\n

wget -O - https:\/\/debian.opennms.org\/OPENNMS-GPG-KEY | apt-key add -<\/code><\/pre>\n\n\n\n

Run package cache update;<\/p>\n\n\n\n

apt update<\/code><\/pre>\n\n\n\n

Next, Install OpenNMS on Ubuntu and all other required packages by running the command below;<\/p>\n\n\n\n

apt install opennms<\/code><\/pre>\n\n\n\n

The command installs OpenNMS and all other require packages including jicmp6<\/em> and jicmp<\/em>, opennms-core<\/em>, opennms-webapp-jetty<\/em>, postgresql<\/em>, postgresql<\/em>–libs<\/em>.<\/p>\n\n\n\n

Configuring OpenNMS db<\/h4>\n\n\n\n

During the installation, you receive a notification that in order to complete the install and setup of OpenNMS, you need to run the installer manually. Click Ok to proceed. This step to finalize the OpenNMS setup will be executed later.<\/p>\n\n\n\n

Postfix Configuration<\/h4>\n\n\n\n

When prompted to select the type of the Postfix mail server configuration, select Internet site<\/strong> and proceed.<\/p>\n\n\n\n

Set system mail name to the system hostname (without the domain name part) as provided by the command hostname -s<\/strong><\/code>.<\/p>\n\n\n\n

You can see how to configure Postfix with Gmail relay on Ubuntu 20.04 by following the link below;<\/p>\n\n\n\n

Configure Postfix to Use Gmail SMTP on Ubuntu 20.04<\/a><\/p>\n\n\n\n

If you encounter such an error;<\/p>\n\n\n\n

Failed to install iplike into the template1 or opennms databases. See \/tmp\/install_iplike.log for details. To skip this step and install manually, set the         \nenvironment variable SKIP_IPLIKE_INSTALL before installing this package. To install iplike into your database, use the \/usr\/sbin\/install_iplike.sh script.  See    \n`install_iplike.sh -h` for more details.<\/code><\/pre>\n\n\n\n

It is because;<\/p>\n\n\n\n

less  \/tmp\/install_iplike.log<\/code><\/pre>\n\n\n\n
psql: error: FATAL:  database \"opennms\" does not exist<\/code><\/pre>\n\n\n\n

This means that you need to initialize the PostgreSQL database before you can proceed to complete OpenNMS setup.<\/p>\n\n\n\n

All the OpenNMS files are installed under, \/usr\/share\/opennms\/<\/strong><\/code>.<\/p>\n\n\n\n

ls -1 \/usr\/share\/opennms\/<\/code><\/pre>\n\n\n\n
bin\ndata\ndeploy\netc\njetty-webapps\nlib\nlogs\nshare\nsystem<\/code><\/pre>\n\n\n\n

Initialize and Setup PostgreSQL Database<\/h4>\n\n\n\n

Before you can run the installer to complete OpenNMS setup, you need to start, create and setup PostgreSQL for OpenNMS.<\/p>\n\n\n\n

Running PostgreSQL Database<\/h5>\n\n\n\n

PostgreSQL database service is started and enabled to run on boot upon installation.<\/p>\n\n\n\n

systemctl status postgresql<\/code><\/pre>\n\n\n\n
\u25cf postgresql.service - PostgreSQL RDBMS\n     Loaded: loaded (\/lib\/systemd\/system\/postgresql.service; enabled; vendor preset: enabled)\n     Active: active (exited) since Wed 2021-01-20 19:12:22 UTC; 24min ago\n   Main PID: 10299 (code=exited, status=0\/SUCCESS)\n      Tasks: 0 (limit: 2282)\n     Memory: 0B\n     CGroup: \/system.slice\/postgresql.service\n\nJan 20 19:12:22 opennms.kifarunix-demo.com systemd[1]: Starting PostgreSQL RDBMS...\nJan 20 19:12:22 opennms.kifarunix-demo.com systemd[1]: Finished PostgreSQL RDBMS.<\/code><\/pre>\n\n\n\n

If not already running, you can start it by running the command;<\/p>\n\n\n\n

systemctl start postgresql<\/code><\/pre>\n\n\n\n
Create OpenNMS PostgreSQL Database and Database User<\/h5>\n\n\n\n

As a PostgreSQL user (postgres<\/code><\/strong>), create OpenNMS database and database user;<\/p>\n\n\n\n

su - postgres -c \"createuser -P opennms\"<\/code><\/pre>\n\n\n\n
su - postgres -c \"createdb -O opennms opennms\"<\/code><\/pre>\n\n\n\n
Reset PostgreSQL Admin Password<\/h5>\n\n\n\n

The password for PostgreSQL administrative user is also needed, hence set one as follows;<\/p>\n\n\n\n

su - postgres -c \"psql -U postgres\"<\/code><\/pre>\n\n\n\n
alter user postgres with password 'ChangeME';<\/code><\/pre>\n\n\n\n

Replace ChangeME<\/strong><\/code> password with your desired strong password.<\/p>\n\n\n\n

Quit the database connection.<\/p>\n\n\n\n

\\q<\/code><\/pre>\n\n\n\n
Configure OpenNMS database connection details<\/h5>\n\n\n\n

Edit the OpenNMS datasources configuration file, \/usr\/share\/opennms\/etc\/opennms-datasources.xml<\/strong><\/code>, and define PostgreSQL database connection details.<\/p>\n\n\n\n

vim \/usr\/share\/opennms\/etc\/opennms-datasources.xml<\/code><\/pre>\n\n\n\n

In the section below, define the OpenNMS PostgreSQL database connection details (highlighted);<\/p>\n\n\n\n

 <jdbc-data-source name=\"opennms\" \n                    database-name=\"opennms\" \n<\/strong>                    class-name=\"org.postgresql.Driver\" \n                    url=\"jdbc:postgresql:\/\/localhost:5432\/opennms\"\n                    user-name=\"opennms\"\n                    password=\"opennsm-password\" \/><\/strong>\n<\/code><\/pre>\n\n\n\n

In the section below, define the PostgreSQL admin password set above;<\/p>\n\n\n\n

  <jdbc-data-source name=\"opennms-admin\" \n                    database-name=\"template1\" \n                    class-name=\"org.postgresql.Driver\" \n                    url=\"jdbc:postgresql:\/\/localhost:5432\/template1\"\n                    user-name=\"postgres\"\n                    password=\"ChangeME\" \/>\n<\/strong><\/code><\/pre>\n\n\n\n

Complete OpenNMS Setup on Ubuntu 20.04<\/h4>\n\n\n\n

Once the database is initialized and setup, you need to run the installer to finalize OpenNMS setup.<\/p>\n\n\n\n

Set JAVA_HOME environment;<\/p>\n\n\n\n

echo JAVA_HOME=\"\/usr\/lib\/jvm\/java-11-openjdk-amd64\" >> \/etc\/environment\nsource \/etc\/environment<\/code><\/pre>\n\n\n\n

Exit the current terminal and launch another terminal to effect the environment variable set above.<\/p>\n\n\n\n

Next, run the command below to detect of Java environment and persist in \/usr\/share\/opennms\/etc\/java.conf<\/strong><\/code>.<\/p>\n\n\n\n

\/usr\/share\/opennms\/bin\/runjava -s<\/code><\/pre>\n\n\n\n
runjava: Looking for an appropriate JVM...\nrunjava: Checking for an appropriate JVM in JAVA_HOME...\nrunjava: Found: \"\/usr\/lib\/jvm\/java-11-openjdk-amd64\/bin\/java\" is an appropriate JVM.\nrunjava: Value of \"\/usr\/lib\/jvm\/java-11-openjdk-amd64\/bin\/java\" stored in configuration file.<\/code><\/pre>\n\n\n\n

Next, complete the setup by running the install command. This will initialize the database and detect system libraries persisted in \/opt\/opennms\/etc\/libraries.properties<\/strong><\/code>.<\/p>\n\n\n\n

\/usr\/share\/opennms\/bin\/install -dis<\/code><\/pre>\n\n\n\n

The initialization and final setup of OpenNMS then runs. If you see the line, Upgrade completed successfully!<\/code><\/strong>, then all is well.<\/p>\n\n\n\n

Running OpenNMS on Ubuntu 20.04<\/h4>\n\n\n\n

Once the installation and setup is done, you can start and enable OpenNMS to run on system boot;<\/p>\n\n\n\n

systemctl enable --now opennms<\/code><\/pre>\n\n\n\n

Checking the status;<\/p>\n\n\n\n

systemctl status opennms<\/code><\/pre>\n\n\n\n
\u25cf opennms.service - OpenNMS server\n     Loaded: loaded (\/lib\/systemd\/system\/opennms.service; enabled; vendor preset: enabled)\n     Active: active (running) since Wed 2021-01-20 20:19:24 UTC; 9s ago\n    Process: 17185 ExecStart=\/usr\/share\/opennms\/bin\/opennms -s start (code=exited, status=0\/SUCCESS)\n   Main PID: 18242 (java)\n      Tasks: 38 (limit: 2282)\n     Memory: 203.2M\n     CGroup: \/system.slice\/opennms.service\n             \u251c\u250018241 bash \/usr\/share\/opennms\/bin\/opennms -s start\n             \u2514\u250018242 \/usr\/lib\/jvm\/java-11-openjdk-amd64\/bin\/java --add-modules=java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.man>\n\nJan 20 20:19:27 opennms.kifarunix-demo.com opennms[18242]: [DEBUG] System property 'opennms.library.jicmp' set to '\/usr\/lib\/jni\/libjicmp.so.  Attempting to load jicmp libr>\nJan 20 20:19:27 opennms.kifarunix-demo.com opennms[18242]: [INFO] Successfully loaded jicmp library<\/code><\/pre>\n\n\n\n

Accessing OpenNMS Web Interface<\/h2>\n\n\n\n

You can now access OpenNMS from browser. To allow external access, OpenNMS web frontend port, 8980\/tcp on firewall;<\/p>\n\n\n\n

ufw allow 8980\/tcp<\/code><\/pre>\n\n\n\n

You can then access OpenNMS web frontend using the URL http:\/\/server-IP-or-resolvable-hostname:8980<\/strong><\/code>.<\/p>\n\n\n\n

You should land on OpenNMS horizon login page.<\/p>\n\n\n\n

\"OpenNMS\"<\/figure>\n\n\n\n

Login using the default credentials, admin<\/strong><\/code> for both username and password. You can reset the password later by navigating to admin > Change password<\/code><\/strong>.<\/p>\n\n\n\n

OpenNMS default dashboard;<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Further Reading<\/h3>\n\n\n\n

So what is next?<\/p>\n\n\n\n

Refer to OpenNMS administration guide to administer OpenNMS.<\/p>\n\n\n\n

OpenNMS Administration Guide<\/a><\/p>\n\n\n\n

Reference<\/h3>\n\n\n\n

OpenNMS installation Guide<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

Follow through the guide to install OpenNMS network monitoring tool on Ubuntu 20.04. OpenNMS is an open-source and enterprise grade network monitoring and management solution.<\/p>\n","protected":false},"author":1,"featured_media":7727,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[72,121],"tags":[3041,3036,3039,3038,3040,3035,3037],"class_list":["post-7718","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-monitoring","category-howtos","tag-install-opennms","tag-install-opennms-ubuntu","tag-installing-opennms-on-ubuntu","tag-opennms","tag-opennms-monitoring-tool","tag-setup-opennms-ubuntu-20-04","tag-ubuntu-opennms-install","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/7718"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=7718"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/7718\/revisions"}],"predecessor-version":[{"id":21962,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/7718\/revisions\/21962"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/7727"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=7718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=7718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=7718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}