Table of Contents

Installing NAV 3 on SuSE Linux Enterprise Server 9

This page is REALLY FANTASTICALLY outdated

Installing the prerequisites

RPM and SuSE

Apart from what seemed to be installed by default, these packages were installed using yast2 (some of these packages might not make sense in a NAV context, but were installed as extra tools during the server preparation):

Perform these commands

This will install required software that is not available from yast2.

Commands:

umask 0022

wget http://jdbc.postgresql.org/download/pg74.215.jdbc3.jar
cp pg74.215.jdbc3.jar $JAVA_HOME/jre/lib/ext/

# The WestHawk Java SNMP library has been replaced by the library found at
# http://gicl.cs.drexel.edu/people/sevy/snmp/
# Must be compiled from source
wget http://gicl.cs.drexel.edu/people/sevy/snmp/source_1.4.zip
# Follow the build instructions in the archive (make SNMPPackage), you should have snmp.jar in the end:
cp snmp.jar $JAVA_HOME/jre/lib/ext/

wget http://c0re.23.nu/c0de/IPy/IPy-0.42.tar.gz
tar xvzf IPy-0.42.tar.gz
cd IPy-0.42
python setup.py install
cd ..

wget http://belnet.dl.sourceforge.net/sourceforge/py-rrdtool/py-rrdtool-0.2.1.tar.gz
tar xvzf py-rrdtool-0.2.1.tar.gz
cd py-rrdtool-0.2.1
python setup.py install
cd ..

# Get latest pysnmp *2* from http://sourceforge.net/projects/pysnmp
tar xvzf pysnmp-2.*.tar.gz
cd pysnmp-2.*
python setup.py install
cd ..

wget http://belnet.dl.sourceforge.net/sourceforge/cheetahtemplate/Cheetah-0.9.16a2.tar.gz
tar xvzf Cheetah-0.9.16a2.tar.gz
cd Cheetah-0.9.16a2
python setup.py install
cd ..

wget http://belnet.dl.sourceforge.net/sourceforge/forgetsql/forgetSQL-0.5.1.tar.gz
tar xvzf forgetSQL-0.5.1.tar.gz
cd forgetSQL-0.5.1
python setup.py install
cd ..

wget http://forgethtml.sourceforge.net/forgethtml-cvs-2004-10-21.tar.gz
tar xvzf forgethtml-cvs-2004-10-21.tar.gz
cd forgethtml
python setup.py install
cd ..

wget http://initd.org/pub/software/psycopg/psycopg-1.1.18.tar.gz
tar xvzf psycopg-1.1.18.tar.gz
cd psycopg-1.1.18
./configure \
--with-postgres-includes=/usr/include/pgsql \
--with-mxdatetime-includes=/usr/lib/python2.3/site-packages/mx/DateTime/mxDateTime
make
make install
cd ..

wget http://www.switch.ch/misc/leinen/snmp/perl/dist/SNMP_Session-1.07.tar.gz
tar xvzf SNMP_Session-1.07.tar.gz
cd SNMP_Session-1.07
perl Makefile.PL
make
make install
cd ..

# Gammu is packaged in a really shitty way, and the spec file is botched
# somehow. We compile from source in this example.
wget http://www.mwiacek.com/zips/gsm/gammu/gammu.tar.gz
tar xvzf gammu.tar.gz
cd gammu-1.01.0
./configure --prefix=/usr/local --disable-bluetooth
make
make install
cd ..
# Configure gammu to use the first serial port
cat << EOF > /etc/gammurc
[gammu]
port=/dev/ttyS0
EOF
# Test that Gammu sees the phone with this:
gammu --identify

Installed NAV 3 from scratch, using RPM

First, run this command to install the NAV rpm:

  rpm -ivh nav-3.0*.noarch.rpm

In addition to installing NAV, this should create the group nav and the user navcron. NAV's SMS Daemon runs as the navcron user, so you need to make sure that the navcron user is permitted to write to the system's serial ports. If you set up your phone on /dev/ttyS0, check to see which group has write permissions to that device, and add the navcron user to that group (On SLES, this is typically the uucp group).

Initializing and configuring the database

Initialize the database using the recipe from /usr/local/nav/doc/sql/README. Use this file whenever you are installing NAV. For upgrading use the correct script from nav/doc/sql/upgrades/.

The password for tha nav-user should be set by using the instructions in this document. If you need to alter the password this can be done by:

psql template1
ALTER USER nav WITH PASSWORD 'foo';
\q
exit

Configure NAV to use these passwords. Changes made to /usr/local/nav/etc/db.conf:

#
# PostgreSQL user passwords.
#
userpw_nav=foo

We need to be able to connect to PostgreSQL using TCP/IP, and we should enable statistics to allow pg_autovacuum to do database maintenance. Make sure these settings are present in /var/lib/pgsql/data/postgresql.conf:

tcpip_socket = true
stats_start_collector = true
stats_row_level = true

And these in pg_hba.conf in the same directory:

local    all         postgres                                       ident sameuser
local    all         all                                            md5
host     all         all        127.0.0.1         255.255.255.255   md5
host     all         all        ::1               ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff         md5

We will not assign a password for the postgres user here, but instead we will demand ident sameuser authentication for the postgres user and grant sudo access to database administrators to perform commands as the postgres user. This means a database administrator on the server can execute sudo -u postgres psql manage to enter SQL commands in the NAVdb, regardless of whether he/she has root access to the server.

We restart PostgreSQL (still as root) and start pg_autovacuum (which should really be started as part of /etc/init.d/postgresql):

/etc/init.d/postgresql restart  
su -c "pg_autovacuum -D" postgres

Configure PostgreSQL to automatically start when the server is restarted:

chkconfig postgresql on

Installing NAV libraries

The RPM packages provided by the NAV team does not install NAV in the preferred layout of the distribution, but rather puts everything into /usr/local/nav. Therefore, we will need to employ a few tricks to make the NAV libraries easily available to all programs on the server (you are free to contribute a .spec file with an alternate installation layout!).

Java

In preference to building a long, ugly CLASSPATH, we symlink all the .jar-files of NAV in the the running JVM's library directory:

cd $JAVA_HOME/jre/lib/ext
ln -s /usr/local/nav/lib/java/*.jar .

Also you need to symlink in the postgres and snmp-drivers. There were linked to /usr/local/nav/lib/java.

Python

In preference to setting a PYTHONPATH environment variable pointing to the NAV Python libraries, we fix sys.path by creating the file usr/lib/python2.3/site-package/sitecustomize.py and placing this code in it:

import sys
sys.path.append('/usr/local/nav/lib/python')

This will make sure that the NAV python libraries are available to all running Python programs on the server, without the need to install these libraries in the library directories of Python.

Perl

As with the Java libraries, we create a few symlinks to the perl libraries (although this is not as straightforward as symlinking the .jar files). Assuming the Perl version on your system is 5.8.3, we do:

cd /usr/lib/perl5/site_perl/5.8.3
ln -s /usr/local/nav/lib/perl/NAV.pm
ln -s /usr/local/nav/lib/perl/NAV
ln -s /usr/local/nav/lib/perl/NetAddr

Tomcat

Tomcat needs the postgres-driver as well. It was linked to /usr/lib/SunJava2-1.4.2/jre/lib/ext.

Configuring Apache

The example Apache 2 configuration from the NAV source tree (http://svn.itea.ntnu.no/repos/nav/navme/trunk/doc/apache/httpd2.conf.example) was used as a basis, and the relevant parts were placed into SuSE's Apache 2 configuration structure.

We recommend installing an SSL server and redirect all non-SSL requests to this server (so all web server traffic, including passwords, are encrypted).

Restart Apache2 and configure it to automatically start when the server is restarted:

/etc/init.d/apache2 restart
chkconfig apache2 on

Configuring Tomcat and the NAV servlets

We configure Tomcat to only listen to the local interface, and the NAV servlets nee d to be symlinked in to the webapps directory. Edited /etc/tomcat/base/server.xml so the following was present:

<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
<Connector port="8080" address="127.0.0.1"
           maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
           enableLookups="false" redirectPort="8443" acceptCount="100"
           debug="0" connectionTimeout="20000"
           disableUploadTimeout="true" />

NAV's servlets are then symlinked:

cd /usr/share/tomcat/webapps
ln -s /usr/local/nav/apache/webapps/*.war .

Next, symlink the .jar files as well:

cd /usr/share/tomcat/shared/lib
ln -s /usr/local/nav/lib/java/*.jar .

Restart Tomcat and configure it to automatically start when the server is restarted:

/etc/init.d/tomcat restart
chkconfig tomcat on

Installing Cricket

'Please note that this part is not yet complete and needs to be revised to make sure that server statistics are collected.'

The user navcron was created by the RPM package, and should have had its HOME set to /usr/local/nav. The NAV integration of Cricket will have it running as the user navcron and not cricket, as the documentation of Cricket would normally suggest. Run:

chgrp nav /usr/local/nav
chmod g+sw /usr/local/nav
wget http://belnet.dl.sourceforge.net/sourceforge/cricket/cricket-1.0.3.tar.gz
su navcron
mkdir ~/cricket
cp cricket-1.0.3.tar.gz ~/cricket/
cd ~/cricket

tar xvzf cricket-1.0.3.tar.gz
ln -s cricket-1.0.3 cricket
cd cricket
sh configure
cp cricket-conf.pl.sample cricket-conf.pl

Edit cricket-config.pl so that it contains the following lines:

package Common::global;
$gCricketHome = "/usr/local/nav/cricket";
$gInstallRoot = "$gCricketHome/cricket";
$gConfigRoot = "$gCricketHome/cricket-config";
$gDbAccess = "slurp";   # Slurp the database into memory

Then we create directories for the configuration- and data trees of Cricket, and for the web cgi script:

cd ~/cricket
mkdir public_html
cd public_html
ln -s ../cricket/images
ln -s ../cricket/grapher.cgi
ln -s ../cricket/lib
ln -s ../cricket/mini-graph.cgi
ln -s ../cricket/VERSION
ln -s grapher.cgi index.cgi
cp /usr/local/nav/doc/cricket/public_html/cricket.css .

mkdir ../cricket-data
ln -s ../cricket-data

cp -r /usr/local/nav/doc/cricket/cricket-config ..
ln -s ../cricket-config

cd ~/cricket/cricket
cp /usr/local/nav/doc/cricket/cricket/* .

Finally, you may initialize the Cricket configuration (event though no IP devices have been registered in NAV yet):

cd ~
cricket/cricket/compile
bin/makecricketconfig.pl
exit

For Cricket to be visible on the web, do the following Apache configuration steps as root:

cd /usr/local/nav/apache/webroot
ln -s ~navcron/cricket/public_html cricket
cd cricket
echo "SetHandler none" > .htaccess

This will tell Apache not to use the mod_python handler in this directory.

Configuring NAV

NAV's configuration files are in /usr/local/nav/etc. We've already made some changes to db.conf to make sure NAV can connect to PostgreSQL. Now we need to adjust some essential values of nav.conf and webfront/webfront.conf before we are ready for launch.

Except for the comments, this is the short version of what needs to be set:

ADMIN_MAIL = <your NAV administrator's e-mail address here!>
DOMAIN_SUFFIX = <your domain suffix here>
AUTO_CREATE_DEVICE = yes
NAVROOT=/usr/local/nav
JAVA_HOME = /usr/lib/java

webfront/webfront.conf

If you would like NAVs web interface to use LDAP authentication, you can set this up here. Also, many users prefer longer session timeouts, which can also be configured here.

Patches

In order to get Alertprofiles to work properly you need to patch forgetSQL with the patch found in contribs in the NAV-source. If you forget this, the alertprofiles webinterface will randomly hang because of a deadlock in the database.