Debian 3.1 tomcat5.5 jdk 1.5 install log
Subscribe

From OpenNMS

Jump to: navigation, search

I had hard time getting OpenNMS to work on a fresh Debian 3.1R2 with Tomcat 5.5 and JDK 1.5. Here is the install log.

Contents

General prerequesites

First, you need to add the contrib and non-free.

#deb file:///cdrom/ sarge main

deb http://ftp.fr.debian.org/debian/ stable main contrib non-free

deb-src http://ftp.fr.debian.org/debian/ stable main
deb http://security.debian.org/ stable/updates main

Update the apt package list with

apt-get update
apt-get install libapr0 libdbd-pg-perl libdbi-perl \
libexpat1 libgetopt-mixed-perl libnet-daemon-perl libplrpc-perl \
metamail libwww-perl libgtk-perl libglib1.2 curl postgresql \
rrdtool libpgjava

JDK installation

Prerequites

Install java packaging tool with the following :

apt-get install java-package

Download the JDK from sun Get the url for downloading from the http://java.sun.com/javase/downloads/index.jsp . Get the url for the Linux self-extracting file then download the installer with wget.

wget url_of_the_package

Swith to a unprivileged user in order to run the java packaging tools :

fakeroot make-jpkg jdk-1_5_0_08-linux-i586.bin

Switch back to the root user and install the generated package :

dpkg -i /tmp/sun-j2sdk1.5_1.5.0+update08_i386.deb

Once installed, the package resides in /usr/lib/j2sdk1.5-sun which can be use as the java_home.

You can test your java installation with following commands :

opennms:~# java -version
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)

tomcat 5.5 Installation

Go to the Apache Tomcat website http://tomcat.apache.org/ and grab the following package in the download section :

  • Core
  • Administration Web Application
  • JDK 1.4 Compatability Package

Unpack the archives

opennms:~/distribs/tomcat-5# ls -L
apache-tomcat-5.5.17-admin.tar.gz  apache-tomcat-5.5.17-compat.tar.gz  apache-tomcat-5.5.17.tar.gz
opennms:~/distribs/tomcat-5# tar xzf apache-tomcat-5.5.17-admin.tar.gz
opennms:~/distribs/tomcat-5# tar xzf apache-tomcat-5.5.17-compat.tar.gz
opennms:~/distribs/tomcat-5# tar xzf apache-tomcat-5.5.17.tar.gz

This will create a directory named apache-tomcat-5.5.17. Now install tomcat in the directory of your choice. I choose /usr/local/tomcat-5.5.17. To ease some task, I add a symlink /usr/local/tomcat.

cp -R apache-tomcat-5.5.17 /usr/local/tomcat-5.5.17
ln -s /usr/local/tomcat-5.5.17 /usr/local/tomcat

Tomcat startup script

You can use this script to start Tomcat. Make shure to update the CATALINA_HOME and JAVA_HOME to match you system.

#!/bin/bash
#
# tomcat
#
# chkconfig:
# description:  Start up the Tomcat servlet engine.

# Source function library.
#. /etc/init.d/functions


RETVAL=$?
CATALINA_HOME="/usr/local/tomcat/"
JAVA_HOME="/usr/lib/j2sdk1.5-sun"

JAVA_OPTS="-Djava.awt.headless=true"

export JAVA_HOME
export JAVA_OPTS
case "$1" in
 start)
        if [ -f $CATALINA_HOME/bin/startup.sh ];
          then
            echo $"Starting Tomcat"
            #/bin/su tomcat $CATALINA_HOME/bin/startup.sh
                $CATALINA_HOME/bin/startup.sh
        fi
        ;;
 stop)
        if [ -f $CATALINA_HOME/bin/shutdown.sh ];
          then
            echo $"Stopping Tomcat"
            #/bin/su tomcat $CATALINA_HOME/bin/shutdown.sh
                $CATALINA_HOME/bin/shutdown.sh

        fi
        ;;
 *)
        echo $"Usage: $0 {start|stop}"
        exit 1
        ;;
esac

exit $RETVAL

Try to start Tomcat with this command:

opennms:~# /etc/init.d/tomcat start
Starting Tomcat
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:       /usr/lib/j2sdk1.5-sun

Now, point your browser the Tomcat server : http://your_server_adress:8080/ . If eveything went fine, you shoud get the standard Tomcat page.

Postgresql configuration

As explained in the install guide (2.4.1 & 2.4.2) http://sourceforge.net/docman/display_doc.php?docid=23937&group_id=4141#N1028E

2.4.1. Customizing the postgresql.conf file

This file controls some basic parameters of Postgres. We need to change three of these parameters.

1. Find the line in the file that contains tcpip_socket. It needs to read (this can be ignored on PostgreSQL 8.0 and later as this is the default):

     tcpip_socket = true

Make sure that there is no comment character ("#") in front of that line (or the other two that you change). This will enable OpenNMS to talk to the database. 2. Find the line in the file that contains max_connections. It needs to read:

>max_c the line that contains shared_buffers. It needs to read:

     shared_buffers = 1024

2.4.2. Customizing the pg_hba.conf file

The pg_hba.conf file controls which machines and users can access the database on a given machine via TCP/IP.

Since that is how OpenNMS accesses the database (via localhost) it is necessary to modify this file to allow OpenNMS to work. The easiest thing to do is to just allow anyone from the localhost to access the database (do not add the last line if your system does not support IPv6):

# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust

Make sure that no other lines are uncommented in this file.

You will need to stop and restart Postgres after making these changes.

OpenNMS installation

Download the following OpenNMS packages from SourceForge.net http://sourceforge.net/project/showfiles.php?group_id=4141&package_id=163038

  • opennms-common_1.2.8-1sarge_all.deb
  • opennms-db_1.2.8-1sarge_all.deb
  • opennms-webapp_1.2.8-1sarge_all.deb
  • opennms_1.2.8-1sarge_all.deb
  • opennms-contrib_1.2.8-1sarge_all.deb
  • librrd0-jni_1.2.8-1sarge_i386.deb
  • libicmp-jni_1.2.8-1sarge_i386.deb
  • libiplike-pgsql_1.2.8-1sarge_i386.deb
  • libopennms-java_1.2.8-1sarge_all.deb

As we installed manually Tomcat and the JDK, some package dependencies will be broken and it will be necessary to force installation without satisfying those dependecies.

Install packages in this particular order : libs

dpkg -i librrd0-jni_1.2.8-1sarge_i386.deb
dpkg -i libicmp-jni_1.2.8-1sarge_i386.deb
dpkg -i libiplike-pgsql_1.2.8-1sarge_i386.deb
dpkg -i libopennms-java_1.2.8-1sarge_all.deb

main software:

dpkg -i opennms-common_1.2.8-1sarge_all.deb
dpkg -i --force-depends opennms-server_1.2.8-1sarge_all.deb
dpkg -i opennms-db_1.2.8-1sarge_all.deb
dpkg -i --force-depends opennms-webapp_1.2.8-1sarge_all.deb

now, we follow the installation

  • Specify the Java binary:
/usr/share/opennms/bin/runjava -S /usr/lib/j2sdk1.5-sun/bin/java
  • Run the database installer :
/usr/share/opennms/bin/install -disU


Webapp installation

As the installer is disabled on Debian, we will have to install the webapp manually.

  • Tomcat port issue

Open the file /etc/opennms/web.xml in a text editor. Locate the line where you have

<param-value>http://localhost:8180/opennms/rtc/post</param-value>

Change the 8180 into 8080. Tomcat Debian package uses port 8180 by defaut, but the standard Tomcat distribution uses the 8080 port.

  • relocate the opennms.xml

Then, gather some files that went where the tomcat4 shoud be:

mv /var/lib/tomcat4/webapps/opennms.xml /usr/share/opennms/webapp/

If you did never install Tomcat4, you can remove the /var/lib/tomcat4/ directory.

Edit the /usr/share/opennms/webapp/opennms.xml file in a text editor and apply this patch http://www.opennms.org/index.php/Tomcat_5#How_to_use_Tomcat_5_with_OpenNMS . Please make shure the local path match you installation. It should look like this :

<Context path="/opennms" docBase="/usr/share/opennms/webapp"
        debug="0" reloadable="true">

  <!--<Logger className="org.opennms.web.log.Log4JLogger" homeDir="/usr/share/opennms" />-->    
  <Realm className="org.opennms.web.authenticate.OpenNMSTomcatRealm" homeDir="/usr/share/opennms" />                                                        

</Context>
  • declare the webapp in Tomcat
cd /usr/local/tomcat/conf/Catalina/localhost
ln -s /usr/share/opennms/webapp/opennms.xml
  • linking the libs
cd /usr/local/tomcat/server/lib/
ln -s /usr/share/opennms/webapp/WEB-INF/lib/castor-0.9.3.9.jar
ln -s /usr/share/opennms/webapp/WEB-INF/lib/castor-0.9.3.9-xml.jar
ln -s /usr/share/opennms/webapp/WEB-INF/lib/log4j.jar
ln -s /usr/share/opennms/webapp/WEB-INF/lib/opennms_common.jar
ln -s /usr/share/opennms/webapp/WEB-INF/lib/opennms_core.jar
ln -s /usr/share/opennms/webapp/WEB-INF/lib/opennms_joesnmp.jar
ln -s /usr/share/opennms/webapp/WEB-INF/lib/opennms_services.jar
ln -s /usr/share/opennms/webapp/WEB-INF/lib/opennms_web.jar
ln -s /usr/share/opennms/webapp/WEB-INF/lib/regexp120.jar

Start the daemon and check

Restart postgresql and tomcat

/etc/init.d/postgresql stop
/etc/init.d/postgresql start
/etc/init.d/tomcat stop
/etc/init.d/tomcat start

start the OpenNMS daemon

/etc/init.d/opennms start

Now, point your browser to your server : http://your_server:8080/opennms/

You sould be able to log in with admin/admin. Within few minutes, the daemon sould apear up and running.

further consideration [COMPLETE ME]

  • Tomcat automatic startup
  • OpenNMS automatic startup not needed since packages include this configuration.