Installation:Debian

From OpenNMS

Contents

Installing on Debian-Based Distributions

These instructions cover installation for most Debian-Based distributions (Debian, Ubuntu, etc.)

Ubuntu 7.10 installation instructions also at Install OpenNMS 1.2.9 on Ubuntu Server 7.10 - Gutsy Gibbon

Add the OpenNMS Repository to Your sources.list

First, you need to tell apt-get how to find OpenNMS. Add the following contents to your /etc/apt/sources.lists file:

 deb http://debian.opennms.org stable main
 deb-src http://debian.opennms.org stable main

(If you wish the latest development version of OpenNMS, (recommended!) use unstable instead of stable.)

 deb http://debian.opennms.org unstable main
 deb-src http://debian.opennms.org unstable main

Add the OpenNMS PGP Key to APT

The OpenNMS Debian repository is signed with a PGP key (fingerprint 22EE DDA6 8698 B02F B2EC 50B7 062B 8A68 4C4C BBD9). You will need to tell APT about the key:

 wget -O - http://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -

On Etch

As Java has been put under the GPL it's sufficient to type "apt-get install opennms" in Etch; the dependencies will be fulfilled automatically. You can go straight to "configure opennms" below.

Install the Sun JDK

You will need the Sun JDK (1.4 or higher for OpenNMS 1.2.x, 1.5 or higher for OpenNMS 1.3.x and up). The easiest way to install it is through apt-get:

 # debian 3.x (sarge)
 # download the JDK from http://java.sun.com/j2se/1.4.2/download.html
 $ sudo apt-get install sun-jdk1.4-installer java-common
 $ sudo build-sun-jdk14
 # debian 4.x and higher
 $ sudo apt-get install sun-java5-jdk

Once it's installed, make sure that it is enabled as the default "java" command:

 $ java -version
 java version "1.5.0_12"
 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
 Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)

If it does not say HotSpot, it is probably not the Sun JVM, and you will need to change the default:

 $ sudo update-alternatives --config java
 
 There are 3 alternatives which provide `java'.
 
   Selection    Alternative
 -----------------------------------------------
           1    /usr/bin/gij-wrapper-4.1
 *+        2    /etc/alternatives/kaffe-system/bin/java
           3    /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
 
 Press enter to keep the default[*], or type selection number: 3
 Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/java' to provide `java'.

Download OpenNMS

 export SKIP_IPLIKE_INSTALL=1
 sudo apt-get update
 sudo apt-get install opennms

Note: if you are using Debian etch (or higher) and installing OpenNMS stable, you may need to force apt-get to download an older version of the apache2-* utilities to satisfy the tomcat4 dependency. If you get an error like this:

 The following packages have unmet dependencies:
   opennms: Depends: opennms-webapp (= 1.2.9-1sarge) but it is not going to be installed

...then before installing OpenNMS, you need to run this:

 sudo apt-get install apache2-common=2.0.54-5sarge2 apache2-utils=2.0.54-5sarge2 tomcat4 libtomcat4-java libant1.6-java

Configure OpenNMS

First, for the purposes of convenience, we are going to set the $OPENNMS_HOME environment variable before running any commands.

 export OPENNMS_HOME=/usr/share/opennms

(If you are not using a bourne-compatible shell, you may need to use different syntax.)


Configure Your Database

OpenNMS needs to be able to connect to PostgreSQL as the "postgres" user (by default) over a TCP/IP connection.

RedHat-based systems
/etc/init.d/postgresql start
/sbin/service postgresql start
pg_hba.conf and postgresql.conf are in /var/lib/pgsql/data
Debian-based systems
/etc/init.d/postgresql-X.X start
pg_hba.conf and postgresql.conf are in /etc/postgresql/X.X/main
Mac OS X (Fink)
/sw/bin/pgsql.sh start

Edit pg_hba.conf to Allow postgres to Authenticate

To allow the "postgres" user to connect, you will need to edit your database's pg_hba.conf file, which is usually created on installation or the first startup of PostgreSQL, depending on your distribution: By default, it will have something like this at the bottom:

 local   all         all                               ident sameuser
 host    all         all         127.0.0.1/32          ident sameuser
 host    all         all         ::1/128               ident sameuser

You will need to change "ident sameuser" to "trust":

 local   all         all                               trust
 host    all         all         127.0.0.1/32          trust
 host    all         all         ::1/128               trust

Edit postgresql.conf to Allow TCP/IP Connections

You may also need to change the postgresql.conf to allow TCP/IP connections, if it cannot do so already. On older PostgreSQL versions, this is enabled with the flag:

 tcpip_socket = true

On newer PostgreSQL versions, this is enabled with:

 # you can use "*" to listen on all addresses
 listen_addresses = 'localhost'

Restart the Database

Once you've made these changes, you need to restart your database.

Create the opennms Database

If not done, use "sudo -u postgres createdb -U postgres -E UNICODE opennms" to create the database in postgres.

Insert the IPLIKE Stored Procedure in the Database

If this is your first time installing OpenNMS or iplike, you should make sure that iplike is configured in your database. First you need to install the iplike package from OpenNMS yum repositories with

 yum install iplike

If the OpenNMS database is already configure, you good to go. If not, you have to manually issue

 install_iplike.sh

Tell OpenNMS Where to Find Java

OpenNMS needs to know where to find Java to be able to start up. To tell it how to do so, you run $OPENNMS_HOME/bin/runjava like so:

 $OPENNMS_HOME/bin/runjava -s

This will search $JAVA_HOME and other common locations for your JDK. If you wish to use a specific JDK, you can run it with the -S flag instead:

 $OPENNMS_HOME/bin/runjava -S /usr/java/jdk1.5.0_12/bin/java

Add the JAVA_HOME in /etc/default/opennms

 JAVA_HOME=/usr

Initialize OpenNMS and the Database

Next, you need to run the OpenNMS installer, which will initialize the OpenNMS database, and do some other basic setup. Upon upgrade, you should run this command again to make sure your database schema and other things required at startup are up-to-date.

In most cases, you can just run:

 $OPENNMS_HOME/bin/install -dis

Sometimes you may need to tell OpenNMS where to find libjicmp.so; in that case, you can use the -l option (OpenNMS 1.3.5 and higher):

 # i386 example
 $OPENNMS_HOME/bin/install -dis -l /usr/lib/jni:/usr/lib
 # x86_64 example
 $OPENNMS_HOME/bin/install -dis -l /usr/lib64/jni:/usr/lib64

Configure Tomcat (OpenNMS 1.2.x or Older Only)

If you are using an older release of OpenNMS, you will need to edit the tomcat configuration to start as root, and potentially to look for the right JVM.

Debian + Tomcat4

Edit /etc/default/tomcat4 make sure that JAVA_HOME points to your Sun JVM, and that tomcat is started as root.

 TOMCAT4_USER=root
 JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun

Also, by default, tomcat4 comes configured to look for a "tomcat-docs" webapp, even if it is not installed. If you do not install the tomcat4-webapps package, you will need to edit /etc/tomcat4/server.xml and comment out the Context path="/tomcat-docs" section:

 <!--
 <Context path="/tomcat-docs" docBase="tomcat-docs" debug="0">
   <Resources className="org.apache.naming.resources.FileDirContext" allowLinking="true" />
 </Context>
 -->

Discover Your Network

Finding Hosts

First, OpenNMS needs to know which devices (or, "nodes") you want it to discover. To discover nodes, OpenNMS does a ping sweep based on the $OPENNMS_HOME/etc/discovery-configuration.xml file, and for any IP address that responds, it will start monitoring. In the most common case, all you need to do is change the include-range to match your IP address range.

Discovery Sample:
Configuration File: discovery-configuration.xml
<discovery-configuration threads="1" packets-per-second="1"
    initial-sleep-time="30000" restart-sleep-time="86400000"
    retries="1" timeout="2000">

    <include-range>
        <begin>192.168.0.1</begin>
        <end>192.168.0.254</end>
    </include-range>

</discovery-configuration>

For more detailed information on discovery configuration, see Discovery.

Start OpenNMS

You should have a basic OpenNMS installation ready now, so start it up:

 sudo /etc/init.d/opennms start

As of OpenNMS 1.3.7, by default, the web UI will come up using the embedded Jetty servlet container, on port 8980. Open your browser and point it at:

 http://yourhost:8980/opennms/

the user name and password are both "admin" to start.

Get Notifications When Problems Occur

To get started, we need to configure the main admin user to have a valid e-mail address.

  1. log in as admin
  2. go to Admin in the menu bar
  3. set the Notification Status radio button to On and click the Update button
  4. go to Configure Users, Groups and Roles and then Configure Users
  5. click the icon under "Modify" for the admin user
  6. set the Email address, and click the Finish button

This should get OpenNMS configured to send the default notifications to the administrator e-mail address.

Notifications are extremely flexible and can be configured to do much more complex escalations, scheduled outages, and user-management. Detailed instructions are available in the Notification Configuration How-To.

Personal tools
DevJam 2008 Sponsors
DevJam 2008 Sponsor: Google
DevJam 2008 Sponsor: Netregistry
DevJam 2008 Sponsor: Papa John's
NewEdge Networks
OpenNMS takes home the gold award!
Join the Free Software Foundation
Support This Project Commercial OpenNMS Support OpenNMS Italia SourceForge.net Logo Our Network Simulator Our Java Profiler The best Java IDE