This tutorial covers installation of OpenNMS on Debian, and Debian-derived distributions like Ubuntu.
This page was tested with:
- OpenNMS 16.0.3-1 on Ubuntu 14.04.3 LTS 64-bit
- 1 Select Your Release and Distribution
- 2 Configure APT
- 3 Preparing the Database for OpenNMS
- 4 Installing Java
- 5 Verification of a local mail transfer agent
- 6 Installing OpenNMS
- 7 Post-Install Configuration
- 8 Start OpenNMS and Connect to the Web UI
- 9 Change the Administrator Password
Select Your Release and Distribution
In order to tailor this tutorial to your distribution, please specify the release you decided upon previously, as well as your distribution version:
Release in OpenNMS means: stable, testing, unstable, snapshot
Adding a Repository
To set up APT to talk to the OpenNMS repository, you'll need to create a file called "
opennms.list" within the "
/etc/apt/sources.list.d" directory, with the following contents to install OpenNMS stable release:
# contents of /etc/apt/sources.list.d/opennms.list deb http://debian.opennms.org stable main deb-src http://debian.opennms.org stable main
The following commands will create this file for you:
cat << EOF | sudo tee /etc/apt/sources.list.d/opennms.list # contents of /etc/apt/sources.list.d/opennms.list deb http://debian.opennms.org stable main deb-src http://debian.opennms.org stable main EOF
stable to install other releases of OpenNMS
- Releases can be found via: http://debian.opennms.org/dists/
- Development feature branches can be installed using
branches/BRANCH-NAMEwhich are listed in: http://debian.opennms.org/dists/branches
Adding the OpenNMS PGP Key to APT
Packages within the APT system are cryptographically signed to ensure their integrity. This step ensures the integrity of the file you've downloaded, as well as a reference to guarantee that the file is provided by who it says it was. These features are useful at install-time as well as during future upgrades.
To install the OpenNMS PGP key into your system, type the following at a command prompt:
wget -O - http://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -
Download and verify OpenNMS package catalogs have been downloadedThen you should be able to run
sudo apt-get updateto get the latest list of packages in your APT repositories, including those in the OpenNMS repository.
To confirm the version of OpenNMS that will be installed, query the OpenNMS package itself for details. This version should match the expected desired version (stable, unstable, etc.). In the example below, the current stable version of OpenNMS (as of Mar. 31, 2015), ver. 15.0.1-1, is shown in the current package cache.
[user@host tmp] apt-cache show OpenNMS
Package: opennms Priority: optional Section: contrib/net Installed-Size: 26 Maintainer: Jeff Gehlbach <email@example.com> Architecture: all Version: 16.0.3-1 ...
Preparing the Database for OpenNMS
Before installing OpenNMS itself, you will want to install PostgreSQL, and do a few things to make sure PostgreSQL is working properly.
The first thing you'll want to do is install the PostgreSQL database itself. On any Debian-based distribution, all you should have to do is install the "
postgresql" package, and it will pull in anything it needs.
sudo apt-get update sudo apt-get install postgresql
Determining Your PostgreSQL Version
The version of PostgreSQL that gets installed depends upon what version distribution you're running. You can see the version of PostgreSQL installed with the "
pg_lsclusters" command. For the purposes of this tutorial, we'll set an environment variable on the shell to make things easier:
PGVERSION=`pg_lsclusters -h | head -n 1 | cut -d' ' -f1`
Example output with PostgreSQL 9.3 installed:
Allowing User Access to the Database
By default, PostgreSQL only allows you to connect if you are logged in to the local account name that matches the PostgreSQL user. Since OpenNMS runs as root, it cannot connect as the operating system's "postgres" or "opennms" users by default, so we have to change the configuration to allow that.
To allow connections as the postgres user to authenticate without a password, you first must change options in the pg_hba.conf file. On Debian-derived systems, this will be located at /etc/postgresql/$PGVERSION/main/pg_hba.conf, where "$PGVERSION" is the environment variable we set earlier containing the version of your PostgreSQL database.
Edit your "
/etc/postgresql/$PGVERSION/main/pg_hba.conf" file now, as root. It should have entries similar to the following at the bottom.
sudo vi /etc/postgresql/$PGVERSION/main/pg_hba.conf
The following example is from PostgreSQL 9.3:
... # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 ...
You will need to change these entries to replace the default authentication methods with the method "trust". The final result should be like the following.
... # TYPE DATABASE USER ADDRESS METHOD # OpenNMS change: configure local, IPv4 and IPv6 connections made from localhost to not require authentication # "local" is for Unix domain socket connections only local all all trust # the default method is peer # IPv4 local connections: host all all 127.0.0.1/32 trust # the default method is md5 # IPv6 local connections: host all all ::1/128 trust # the default method is md5 ...
Once you have finished making changes, restart the database (as root):
sudo service postgresql restart
On older releases of Debian, you may need to instead run "sudo service postgresql-$PGVERSION restart"
On older releases of Ubuntu such as Ubuntu 10.04 with PostgreSQL 8.4, you may need to instead run "sudo service postgresql-$PGVERSION restart"
Additionally, while it's beyond the scope of this beginning tutorial, you may want to check the PostgreSQL section of the Performance Tuning page to get the most out of your database installation.
You'll need to install the Oracle Java 8 package or OpenJDK Java 8 package in order to satisfy the dependencies of the OpenNMS package.
Oracle Java 8
For Debian, see the instructions at http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html for how to do this before progressing to installing OpenNMS.
For Ubuntu, Oracle Java is not available in the standard Ubuntu repositories. The Ubuntu wiki at https://help.ubuntu.com/community/Java outlines other options. One recommendation there is to use the WebUpd8 package archives method described at http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html as this will also keep the Oracle JDK up to date as new releases come out.
These are the Ubuntu WebUpd8 Oracle Java installation commands.
# install the add-apt-repository program sudo apt-get install software-properties-common # add the private package archive webupd8team/java sudo add-apt-repository ppa:webupd8team/java sudo apt-get update # install Oracle Java8 sudo apt-get install oracle-java8-installer # setup Oracle Java8 to be the default Java VM sudo apt-get install oracle-java8-set-default
OpenJDK Java 8
If the Oracle Java package is not being used, install the OpenJDK Java package with apt-get as root.
On Ubuntu 15.04 or later, OpenJDK Java 8 is available in the standard Ubuntu repositories. Earlier versions of Ubuntu only have OpenJDK Java 7 available.
sudo apt-get update sudo apt-get install openjdk-8-jdk
Verification of the Java version
This is sample output using Oracle Java 8.
java version "1.8.0_66" Java(TM) SE Runtime Environment (build 1.8.0_66-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
Verification of a local mail transfer agent
OpenNMS sends out e-mail by default through a local mail transfer agent listening on port 25. Confirm that a MTA (e.g. exim or postfix) is installed. One way to check for this is to telnet to port 25 on the server and ensure a SMTP banner is displayed.
If a MTA is not present, install it with the following command:
sudo apt-get install default-mta
For Debian, the default MTA is exim. Accept the default debconf configuration responses when configuring exim.
For Ubuntu, the default MTA is postfix. When asked what mail configuration to use, select the default option, "Internet Site" and the default hostname of the server on the next configuration page.
With all the prerequisites taken care of, you can now install OpenNMS. The OpenNMS software is not a single package, but a combination of many components. The APT packaging system will download and install all of these components and their dependencies, if they are not already installed on your system.
There are many packages available in the OpenNMS APT repository, but the easiest way to get started is to install the "
opennms" package. This will pull in everything you need to have a working OpenNMS, including the OpenNMS core, web UI, and a set of common plugins.
You can do so by running (as root):
sudo apt-get install opennms
The installer typically has two prompts: "The OpenNMS installer must now be run manually" and a warning that "IPLIKE installation failed". Please select "<Ok>" for both questions to continue.
The IPLIKE warning is normal, as this package will attempt to install itself into the OpenNMS database, but on a new install the database has not been configured yet. We will re-attempt the install later.
Optional: Disable OpenNMS updates
Your operating system may be configured to do automatic updates of all packages at regular intervals or a system administrator could potentially run a manual update and inadvertently upgrade OpenNMS resulting in a misconfiguration or complete failure.
To avoid these scenarios, you may want to disable the OpenNMS repositories after a successful installation by editing the "/etc/apt/sources.list.d/opennms.list" file and commenting out each "deb" section by adding a # to the start of each line. This can just as easily be changed back when it's time to upgrade.
Next, you need to tell OpenNMS which Java you want it to use, using the "$OPENNMS_HOME/bin/runjava" command.
To have OpenNMS search for and auto-detect the JRE, run:
sudo $OPENNMS_HOME/bin/runjava -s
runjava: Looking for an appropriate JRE... runjava: Checking for an appropriate JRE in JAVA_HOME... runjava: skipping... JAVA_HOME not set runjava: Checking JRE in user's path: "/usr/bin/java"... runjava: found an appropriate JRE in user's path: "/usr/bin/java" runjava: value of "/usr/bin/java" stored in configuration file
To configure OpenNMS to use a specific JRE binary, use the "-S" with the path to the desired binary.
sudo $OPENNMS_HOME/bin/runjava -S /usr/bin/java
Create/Update the OpenNMS Database
Whenever you install OpenNMS or upgrade it, you should run the "
sudo $OPENNMS_HOME/bin/install -dis" command, to create the OpenNMS database, or update it to the latest version. The install command takes many options, but in most cases all you should need are the three options below:
- -d - to update the database
- -i - to insert any default data that belongs in the database
- -s - to create or update the stored procedures OpenNMS uses for certain kinds of data access
A warning "Failed to load the optional jrrd library." during installation is normal and not a problem, as jrrd use is optional. The installation should finish with the line "Installer completed successfully!".
(Optional but recommended) Install IPLIKE database stored procedure
OpenNMS uses a PostgreSQL stored procedure called "IPLIKE" which provides an API for easily performing complicated IP address queries. By default, OpenNMS installs a version of IPLIKE that is compatible with all versions of PostgreSQL, but there is a platform-specific version of IPLIKE with much better performance. While it is optional, it is recommended that you configure the iplike package from APT for performance reasons.
The appropriate IPLIKE package (eg, iplike-pgsql84, iplike-pgsql90, etc.) for your database should already have installed when you installed the main "
opennms" package. All you should need to do is re-run the "install_iplike" shell script (as root):
This is the expected output if the installation was successful:
Verify connectivity to the OpenNMS database
At this point, you can check the network listener and authentication changes, as well as whether or not your DB creation worked properly by trying to connect to the OpenNMS database as the postgres database user from localhost.
psql -U postgres --host=localhost opennms
If you are presented with a prompt that looks like
opennms=#, you can type \q and quit the PostgreSQL shell as the database connection was successful. If this was not successful, you will need to review your PostgreSQL configuration before continuing.
Start OpenNMS and Connect to the Web UI
You can now start OpenNMS using the "service" command (as root).
Change the Administrator Password
As mentioned above, the default username is "admin" and the default password is "admin" as well. It is recommended that you change the administrator user's password, for security reasons. To do so, log in to the web UI and then click on the username (admin) in the upper-right corner, and then click "Change Password." Enter the old and new passwords in the prompt, and click "OK."