This is an old revision of the document!
Table of Contents
Installing NAV from source on Debian GNU/Linux
This is an attempt at a guide and a few helpful pointers for those who don't care to use the prepackaged NAV for Debian.
Versions used:
| Debian | 4.0 (Etch) |
|---|---|
| NAV | 3.3.3 |
Installing dependencies
Make sure you have the non-free archive present in your
sources.list. Install NAV's runtime dependencies:
sudo aptitude install perl python sun-java5-jdk apache2-mpm-prefork \
cricket php4-gd php4-pgsql postgresql-8.1 tomcat5.5 \
libapache2-mod-php4 libapache2-mod-python libpgjava \
libpg-perl libnetaddr-ip-perl libdbd-pg-perl \
libsnmp1.4-java libsnmp-session-perl python-pysnmp2 \
logrotate python-cheetah python-egenix-mxdatetime \
python-forgethtml python-forgetsql python-gammu \
python-ipy python-ldap python-psycopg python-rrd \
makepasswd wwwconfig-common samba-common
OR, check out Morten Werner Forsbring's dummy NAV package, which depends on all of the above. See the following nav-users posting for details: https://postlister.uninett.no/sympa/arc/nav-users/2008-02/msg00001.html . Be aware that NAV doesn't run well under the kaffe Java VM, which is why you should confirm that Sun's Java 5 JDK is installed (sun-java5-jdk).
Next, NAV's build time dependencies:
sudo aptitude install sun-java5-jdk ant autoconf libsnmp1.4-java libtomcat5.5-java python python-cheetah tomcat5.5
Unpacking and building NAV
tar xvzf nav-3.3.3.tar.gz cd nav-3.3.3 autoconf ./configure export CLASSPATH=/usr/share/java/libsnmp-1.4.jar:/usr/share/java/postgresql.jar:/usr/share/java/servlet-api.jar make sudo make install
Installing and initializing the database schema
Edit /etc/postgresql/8.1/main/pg_hba.conf, change ident sameuser into md5 for local users connecting through UNIX sockets (except the postgres user). The file should look something like this:
local all postgres ident sameuser local all all md5 host all all 127.0.0.1/32 md5 host all all ::1/128 md5
Then reload PosttgreSQL to make the changes effective:
sudo invoke-rc.d postgresql-8.1 reload
While still in the NAV source code directory, cd to doc/sql. The following set of commands assume you have sudo access to run commands as the postgres system user. If not, please become the postgres user in some other way. The procedure has been adapted from doc/sql/README.
To create the set of PostgreSQL users and databases:
sudo -u postgres bash # The following command will prompt for a password for the new database user. # Pick one of your own choosing. createuser --no-createrole --no-createdb --no-superuser --pwprompt nav createdb --owner nav --encoding UTF-8 manage createdb --owner nav --encoding UTF-8 navprofiles createdb --owner nav --encoding UTF-8 logger createdb --owner nav --encoding UTF-8 arnold createlang plpgsql manage createlang plpgsql navprofiles
Then initialize the schemas and data:
# First, export the password you selected for the database user above: export PGPASSWORD=<secretpassword> psql -f manage.sql manage nav psql -f types.sql manage nav psql -f snmpoid.sql manage nav psql -f navprofiles.sql navprofiles nav psql -f logger.sql logger nav psql -f arnold.sql arnold nav
Then, take the password you chose for the database user and put this as the value to the
userpw_nav option in /usr/local/nav/etc/db.conf.
Fixing Python
We do this because we don't install the libraries to the systemwide Python library directories. We do however want them available for use systemwide:
sudo bash -c 'cat << EOF > /usr/local/lib/python2.4/site-packages/sitecustomize.py
import sys
__navpath = "/usr/local/nav/lib/python"
if __navpath not in sys.path:
sys.path.append(__navpath)
EOF
'
Fixing Java
cd /var/lib/tomcat5.5/webapps sudo ln -s /usr/local/nav/apache/webapps/*.war . cd /usr/local/nav/lib/java sudo ln -s /usr/share/java/postgresql.jar sudo ln -s /usr/share/java/libsnmp-1.4.jar
Change /etc/tomcat5.5/server.xml, the line that reads <Connector port=“8180” maxHttpHeaderSize=“8192”: alter port=“8180” to port=“8080”, as NAV expects Tomcat to listen to this port.
Change /etc/default/tomcat5.5, make sure the following two options are set like this:
CATALINA_OPTS="-Djava.awt.headless=true -Xmx128M -server -Djava.ext.dirs=/usr/local/nav/lib/java" TOMCAT5_SECURITY=no
Then run the following:
sudo invoke-rc.d tomcat5.5 restart
Fixing Perl
cd /usr/share/perl5 sudo ln -s /usr/local/nav/lib/perl/NAV* .
Configuring Apache
Put this in /etc/apache2/sites-available/default-nav:
ServerName nav.example.com
ServerAdmin webmaster@example.com
DirectoryIndex index.html index.html index.php index.cgi index.py
AccessFileName .htaccess
AddDefaultCharset UTF-8
AddHandler cgi-script .cgi
DocumentRoot /usr/local/nav/apache/webroot
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/usr/local/nav/apache/webroot">
Options Indexes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
LogLevel warn
<Location />
# Let NAV authorize all access to this location
PythonHeaderParserHandler nav.web
PythonDebug on
</Location>
Then run the following commands:
sudo a2dissite default sudo a2ensite default-nav sudo a2enmod php4 sudo a2enmod mod_python sudo invoke-rc.d apache2 force-reload
Cleaning up and configuring
Create groups and users, and set proper permissions:
sudo addgroup --system nav
sudo adduser --system --no-create-home --home /usr/local/nav \
--shell /bin/sh --ingroup nav navcron;
sudo addgroup navcron dialout
cd /usr/local/nav/var
sudo chown -R navcron:nav .
Edit /usr/local/nav/etc/nav.conf, set your ADMIN_MAIL and DOMAIN_SUFFIX options.
Optionally make the nav process control command more available: sudo ln -s /usr/local/nav/bin/nav /usr/sbin/nav
Fixing Cricket
Cricket should already be installed as it is a part of the runtime dependencies.
Remove /etc/cron.d/cricket or comment out the line starting with the following:
*/5 * * * * cricket ...
Create a directory to place the nav cricket-config:
sudo mkdir /usr/local/nav/etc/cricket-config
Change owner to navcron.nav and make sure nav can write:
sudo chown navcron.nav cricket-config/ sudo chmod g+w cricket-config/
Edit the /etc/cricket/cricket-conf.pl and set this variable:
$gConfigRoot = "/usr/local/nav/etc/cricket-config"
Copy /usr/local/nav/doc/cricket/cricket/subtree-sets to /etc/cricket/
cd /etc/cricket sudo cp /usr/local/nav/doc/cricket/cricket/subtree-sets .
As navcron, copy recursively /usr/local/nav/doc/cricket/cricket-config/ to your cricket-config
sudo -u navcron cp -r /usr/local/nav/doc/cricket/cricket-config/ /usr/local/nav/etc/cricket-config/
Decide where you want Cricket to store it's datafiles, and create that directory as navcron.
sudo -u navcron mkdir /usr/local/nav/var/cricket-data/
Go to the cricket-config directory and edit the “Defaults” file. Replace the Datadir with the correct path to cricket-data. Don't forget the %auto-target-path%
Target --default--
dataDir = /usr/local/nav/var/cricket-data/%auto-target-path%
Compile the cricket-config as navcron to create the cricket-database.
sudo -u navcron cricket-compile
Run makecricketconfig.pl to create config from the database. The first time, remember that the database should contain data before doing this. Also, it's a good idea to start getDeviceData and let it run a good couple of minutes before making the cricket-config as it then will have gathered and stored data in the database.
cd /usr/local/nav/bin sudo -u navcron ./makecricketconfig.pl
Now to logging. Cricket defaults to /var/log/cricket as logdir. This directory is created on install, but the owner is cricket. Either create your own logdir and set the correct path ($gLogDir) in /etc/cricket/cricket-conf.pl or change ownership of /var/log/cricket to navcron.
Finally we fix nav's startupscript for cricket. Go to /usr/local/nav/etc/cron.d/ and edit “cricket”.
CRICKETDIR = /usr/lib/cgi-bin/cricket */5 * * * * $CRICKETDIR/collect-subtrees normal 12 5 * * * $BINDIR/makecricketconfig.pl 0 5 * * * $BINDIR/cleanrrds.pl -d -p /usr/local/nav/var/cricket-data/
Now, start Cricket:
cd /usr/local/nav/bin sudo ./nav start cricket
Cricket Web
Make a symlink to the cricket cgi-scripts
cd /usr/local/nav/apache/webroot sudo ln -s /usr/lib/cgi-bin/cricket/
Create index.cgi, copy css-file to directory
cd /usr/local/nav/apache/webroot/cricket/ sudo ln -s grapher.cgi index.cgi sudo cp /usr/local/nav/doc/cricket/public_html/cricket.css .
