User Tools

Site Tools


installing_from_source_on_debian

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
installing_from_source_on_debian [2007/09/18 08:38]
morten created
installing_from_source_on_debian [2011/06/24 08:05] (current)
vegardv [Installing dependencies]
Line 1: Line 1:
 ====== Installing NAV from source on Debian GNU/Linux ====== ====== 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. ​ The versions ​used here are //Debian Etch// and //NAV 3.3.0-rc1//.+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 | 5.0 (//Lenny//) | 
 +^ NAV    | 3.7             | 
 + 
 + 
 +===== Installing dependencies ===== 
 + 
 +Make sure you have the //​non-free//​ archive present in your 
 +''​sources.list'':​ 
 + 
 +<​code>​ 
 +deb http://​ftp.no.debian.org/​debian/​ lenny main contrib non-free 
 +deb-src http://​ftp.no.debian.org/​debian/​ lenny main contrib non-free 
 + 
 +deb http://​security.debian.org/​ lenny/​updates main contrib non-free 
 +deb-src http://​security.debian.org/​ lenny/​updates main contrib non-free 
 +</​code>​ 
 + 
 +Install NAV's runtime dependencies:​ 
 + 
 +<​code>​ 
 +sudo aptitude install perl python sun-java6-jdk apache2-mpm-prefork \ 
 +                      cricket postgresql-8.3 libapache2-mod-python \ 
 +                      libpg-java libsnmp1.4-java python-pysnmp2 logrotate \ 
 +       python-cheetah python-xmpp python-django \ 
 +       python-egenix-mxdatetime python-gammu python-ipy \ 
 +                      python-ldap python-psycopg2 python-pyrad \ 
 +       python-pysnmp-se python-twisted python-twisted-snmp \ 
 +       python-rrd rrdtool samba-common 
 +</​code>​ 
 + 
 +Be aware that NAV doesn'​t run well under the //kaffe// Java VM, which is why you should confirm that Sun's Java JDK is installed (''​sun-java6-jdk''​) ​and is the active alternative for the ''​java''​ and ''​javac''​ commands: 
 + 
 +<​code>​ 
 +sudo update-alternatives --config java 
 +sudo update-alternatives --config javac 
 +</code> 
 + 
 +Next, NAV's build time dependencies:​ 
 + 
 +<​code>​ 
 +sudo aptitude install ant autoconf automake libsnmp1.4-java python python-cheetah sun-java5-jdk make 
 +</code> 
 + 
 +===== Unpacking and building ​NAV ===== 
 +<​code>​ 
 +tar xvzf nav-3.7.0.tar.gz 
 +cd nav-3.7.0 
 +./configure CRICKETDIR=/​usr/​share/​cricket 
 +export CLASSPATH=/​usr/​share/​java/​libsnmp-1.4.jar 
 +make 
 +sudo make install 
 +</code> 
 +Note: avoid using -j when calling make. It will break the build, since make tries to run many ant processes with interdependencies at the same time. 
 + 
 + 
 +===== Installing and initializing the database schema ===== 
 +Edit ''​/etc/​postgresql/​8.3/​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: 
 +<​code>​ 
 +local   ​all ​        ​postgres ​                         ident sameuser 
 +local   ​all ​        ​all ​                              md5 
 + 
 +host    all         ​all ​        ​127.0.0.1/​32 ​         md5 
 +host    all         ​all ​        ::​1/​128 ​              md5 
 +</​code>​ 
 + 
 +Then reload PostgreSQL to make the changes effective:​ 
 +<​code>​ 
 +sudo invoke-rc.d postgresql-8.3 reload 
 +</​code>​ 
 + 
 +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 PostgreSQL user and database: 
 +<​code>​ 
 +# The following command will prompt for a password for the new database user. 
 +# Pick one of your own choosing.  
 +sudo -u postgres ./​createdb.sh 
 +</​code>​ 
 + 
 +:!: 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 library path ===== 
 +We do this because we don't install the libraries to the systemwide Python library directories by default. ​ We do however want them available for use systemwide:​ 
 +<​code>​ 
 +sudo bash -c 'cat << EOF >> /​etc/​python2.5/​sitecustomize.py 
 + 
 +import sys 
 +__navpath = "/​usr/​local/​nav/​lib/​python"​ 
 +if __navpath not in sys.path: 
 +    sys.path.append(__navpath) 
 +EOF 
 +
 +</​code>​ 
 + 
 + 
 + 
 +===== Fixing Java libraries ===== 
 +<​code>​ 
 +cd /​usr/​local/​nav/​lib/​java 
 +sudo ln -s /​usr/​share/​java/​postgresql.jar 
 +sudo ln -s /​usr/​share/​java/​libsnmp-1.4.jar 
 +</​code>​ 
 + 
 +===== Configuring Apache ===== 
 +Put this in ''/​etc/​apache2/​sites-available/​default-nav'':​ 
 +<​code>​ 
 +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 /> 
 +    # Enable debugging on errors, if you like 
 +    PythonDebug on 
 +</​Location>​ 
 +</​code>​ 
 + 
 +Then run the following commands: 
 +<​code>​ 
 +sudo a2dissite default 
 +sudo a2ensite default-nav 
 +sudo a2enmod mod_python 
 +sudo invoke-rc.d apache2 force-reload 
 +</​code>​ 
 + 
 +===== Cleaning up and configuring ===== 
 +Create groups and users, and set proper permissions:​ 
 +<​code>​ 
 +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 . 
 +</​code>​ 
 + 
 +Edit ''/​usr/​local/​nav/​etc/​nav.conf'',​ set your ''​ADMIN_MAIL''​ and ''​DOMAIN_SUFFIX''​ options. 
 +Also set ''​DJANGO_DEBUG=True''​ if you want complete error information when stuff goes awry in the web interface. 
 + 
 +Optionally make the nav process control command more available: ''​sudo ln -s /​usr/​local/​nav/​bin/​nav /​usr/​sbin/​nav''​ 
 + 
 + 
 +===== Initialize Cricket configuration ===== 
 + 
 +Cricket should already be installed as it is a part of the runtime dependencies.  
 + 
 +Remove ''/​etc/​cron.d/​cricket''​ or comment out the active cron job line in the file. 
 + 
 +Create a directory to place the nav cricket-config:​ 
 +<​code>​sudo mkdir /​usr/​local/​nav/​etc/​cricket-config</​code>​ 
 + 
 +Change owner to navcron:​nav 
 +<​code>​ 
 +sudo chown navcron:nav /​usr/​local/​nav/​etc/​cricket-config 
 +</​code>​ 
 + 
 +Edit the /​etc/​cricket/​cricket-conf.pl and set the configroot variable. At the same time, fix the 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. 
 +<​code>​ 
 +$gConfigRoot = "/​usr/​local/​nav/​etc/​cricket-config"​ 
 +$gLogDir = your/​log/​dir 
 +</​code>​ 
 + 
 +Copy /​usr/​local/​nav/​doc/​cricket/​cricket/​subtree-sets to /​etc/​cricket/​ 
 +<​code>​ 
 +cd /​etc/​cricket 
 +sudo cp /​usr/​local/​nav/​doc/​cricket/​cricket/​subtree-sets . 
 +</​code>​ 
 + 
 +As navcron, copy recursively /​usr/​local/​nav/​doc/​cricket/​cricket-config/​ to your cricket-config 
 +<​code>​ 
 +sudo -u navcron cp -r /​usr/​local/​nav/​doc/​cricket/​cricket-config /​usr/​local/​nav/​etc/​ 
 +</​code>​ 
 + 
 +Create a directory to store Cricket'​s data files, and give ''​navcron''​ ownership of that directory. 
 +<​code>​ 
 +sudo mkdir /​usr/​local/​nav/​var/​cricket-data 
 +sudo chown navcron /​usr/​local/​nav/​var/​cricket-data 
 +</​code>​ 
 + 
 +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% 
 +<​code>​ 
 +Target ​ --default-- 
 +    dataDir ​        = /​usr/​local/​nav/​var/​cricket-data/​%auto-target-path% 
 +</​code>​ 
 + 
 +Compile the cricket-config as navcron to create the cricket-database. 
 +<​code>​sudo -u navcron cricket-compile</​code>​ 
 + 
 +Run ''​mcc.py''​ 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 ''​ipdevpoll''​ and let it run a good couple of minutes before making the cricket-config as it then will have gathered and stored information about devices and interfaces in the database. 
 +<​code>​ 
 +cd /​usr/​local/​nav/​bin 
 +sudo -u navcron ./mcc.py 
 +</​code>​ 
 + 
 +Now, start Cricket: 
 +<​code>​ 
 +cd /​usr/​local/​nav/​bin 
 +sudo ./nav start cricket 
 +</​code>​ 
 + 
 +==== Cricket Web ==== 
 + 
 +Create the cricket directory in apache/​webroot/​ 
 +<​code>​ 
 +cd /​usr/​local/​nav/​apache/​webroot 
 +sudo mkdir cricket 
 +</​code>​ 
 + 
 +Make a symlink to the cricket cgi-scripts and copy cricket.css from source. 
 +<​code>​ 
 +cd /​usr/​local/​nav/​apache/​webroot/​cricket 
 +sudo ln -s /​usr/​lib/​cgi-bin/​cricket/​grapher.cgi  
 +sudo ln -s /​usr/​lib/​cgi-bin/​cricket/​mini-graph.cgi 
 +sudo ln -s grapher.cgi index.cgi 
 +sudo ln -s /​usr/​share/​cricket/​images 
 +sudo cp /​usr/​local/​nav/​doc/​cricket/​public_html/​cricket.css . 
 +</​code>​ 
 + 
 +Create .htaccess-file to make sure mod_python doesn'​t handle this directory. 
 +<​code>​ 
 +sudo bash -c 'echo "​SetHandler none" > .htaccess'​ 
 +</​code>​ 
installing_from_source_on_debian.1190104733.txt.gz · Last modified: 2007/09/18 08:38 by morten