13.1. Installation and test requirements

Here you can find out a standard way to install the software needed by SANET to work properly. The procedures shown below are intended as general instruction for GNU/Linux systems and might not be the best and simplest way to go on your system. In order to install these software please refer to your system documentation when possible.

13.1.1. PostgreSQL

SANET works much better using Postgres rather than MySQL. Hence postgres is strongly reccomended. Instructions on how to use MySQL are given anyway.

The only possible problem while building postgres is given by missing readline. Compiling without readline is possible but deprecated. Installing readline, even though optional, is reccommended (for slackware distribution it can be downlaoded and installed using installpkg).

root@clarabella:~# wget http://ftp2.it.postgresql.org/mirrors/postgres//source/v8.3.1/postgresql-8.3.1.tar.bz2
root@clarabella:~# tar xjvf postgresql-8.3.1.tar.bz2
root@clarabella:~# cd postgresql-8.3.1
root@clarabella:~/postgresql-8.3.1# ./configure --enable-thread-safety --prefix=/usr/local/pgsql-8.3.1 && make && make install
...
root@clarabella:~/postgresql-8.3.1# groupadd postgres
root@clarabella:~/postgresql-8.3.1# useradd -g postgres postgres

Postgres installation requires around 90MB of disk space and obviously the directory used for compiling needs to be readable by the postgres user. Before continuing with the installation it is reccomended to run some tests to check that everything is working fine.

root@clarabella:~/postgresql-8.3.1# chown -R postgres.postgres .
root@clarabella:~/postgresql-8.3.1# cd ..
root@clarabella:~# mv postgresql-8.3.1 /var/tmp
root@clarabella:~# cd /var/tmp/postgresql-8.3.1/
root@clarabella:/var/tmp/postgresql-8.3.1# su postgres
postgres@clarabella:/var/tmp/postgresql-8.3.1$ make check
...

=======================
 All 114 tests passed.
=======================

make[2]: Leaving directory `/var/tmp/postgresql-8.3.1/src/test/regress'
make[1]: Leaving directory `/var/tmp/postgresql-8.3.1/src/test'
postgres@clarabella:/var/tmp/postgresql-8.3.1$
postgres@clarabella:/var/tmp/postgresql-8.3.1$ exit
root@clarabella:/var/tmp/postgresql-8.3.1# cd
root@clarabella:~# rm -rf postgresql-8.3.1.tar.bz2 /var/tmp/postgresql-8.3.1

To continue the installation some links are needed:

root@clarabella:~# cd /usr/local
root@clarabella:/usr/local# ln -s pgsql-8.3.1 pgsql
root@clarabella:/usr/local# cd bin
root@clarabella:/usr/local/bin# ln -s ../pgsql/bin/* .
root@clarabella:/usr/local/bin# cd ..
root@clarabella:/usr/local# cd include/
root@clarabella:/usr/local/include# ln -s ../pgsql/include/* .
root@clarabella:/usr/local/include# cd ..
root@clarabella:/usr/local# cd lib
root@clarabella:/usr/local/lib# ln -s ../pgsql/lib/* .
root@clarabella:/usr/local/lib# cd ..
root@clarabella:/usr/local# ldconfig
root@clarabella:/usr/local# cd man/man1
root@clarabella:/usr/local/man/man1# ln -s ../../pgsql/man/man1/* .
root@clarabella:/usr/local/man/man1# cd ..
root@clarabella:/usr/local/man# cd man7
root@clarabella:/usr/local/man/man7# ln -s ../../pgsql/man/man7/* .
root@clarabella:/usr/local/man/man7# cd ../../pgsql

Finally postgres can be set up:

root@clarabella:/usr/local/pgsql# mkdir data
root@clarabella:/usr/local/pgsql# chown postgres.postgres data
root@clarabella:/usr/local/pgsql# su - postgres
...
postgres@clarabella:/$ initdb -D /usr/local/pgsql/data --locale=en_US.utf8
...
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    postgres -D /usr/local/pgsql/data
or
    pg_ctl -D /usr/local/pgsql/data -l logfile start

postgres@clarabella:/$ exit
logout
root@clarabella:/usr/local/pgsql# cat > /etc/rc.d/rc.postgres
#!/bin/sh

export base=/usr/local/pgsql
export logfile=$base/data/$(hostname).log

case "$1" in
'start')
  su postgres -c "$base/bin/postgres -D $base/data >$logfile 2>&1 &"
  ;;
'stop')
  killall postgres
  ;;
'restart')
  $0 stop
  sleep 5
  $0 start
  ;;
\*)
  echo "usage $0 start|stop|restart"
esac

(fate CTRL+D per terminare l'input)
root@clarabella:/usr/local/pgsql# chmod +x /etc/rc.d/rc.postgres
root@clarabella:/usr/local/pgsql# /etc/rc.d/rc.postgres start
root@clarabella:/usr/local/pgsql# vi /etc/rc.d/rc.local

The command “/etc/rc.d/rc.postgres start” needs to be inserted in rc.local. Obviously rc.pinger noods rc.postgres.

13.1.2. Redis Server

Install the version 2 (2.0.0) of Redis server.

13.1.2.1. Install from sources

Download and compile:

cd /usr/local/src
wget http://redis.googlecode.com/files/redis-2.0.0.tar.gz
tar -xzvf redis-2.0.0-rc4.tar.gz
cd redis-2.0.0-rc4
make

Install the sources in /usr/local/:

cd /usr/local/src
mv redis-2.0.0-rc4  /usr/local
cd /usr/local/
ln -s redis-2.0.0-rc4 redis

13.1.2.2. Prepare launch scripts

Link the config file:

mkdir /etc/redis
cd /etc/redis
ln -s /usr/local/redis/redis.conf .

Create the launch script file:

/etc/rc.d/rc.redis

with the following content:

#!/bin/sh

REDIS_BIN='redis-server'

REDIS_CONFIG_FILE=/etc/redis/redis.conf

REDIS_PID_FILE=$(grep 'pidfile' $REDIS_CONFIG_FILE | awk -F" " '{print $2}')

case "$1" in
        'start')
                echo "Starting redis server..."
                cat $REDIS_CONFIG_FILE | $REDIS_BIN -
                ;;
        'stop')
                PID=$(cat $REDIS_PID_FILE)
                echo "Stopping redis server (pid=$PID)..."
                kill $PID
                ;;
        'restart')
                $0 stop
                $0 start
                ;;
        *)
                echo "usage $0 start|stop|restart"
esac

13.1.2.3. Configure Redis for SANET

Move inside Redis’s installation directory:

cd /usr/local/redis
cp redis.conf redis.conf.dist

Apply the following patch to the config file:

patch redis.conf  patch_file.diff

The patch file content:

17c17
< daemonize no
---
> daemonize yes
32c32
< timeout 300
---
> timeout 0
45c45
< logfile stdout
---
> logfile /var/log/redis.log
89c89
< dir ./
---
> dir /usr/local/redis
233c233,234
< vm-max-memory 0
---
> #vm-max-memory 0
> vm-max-memory 350MB

13.1.3. Python modules

On the python side psycopg2 (Postgres drivers) and django are used. Django must be version 1.2 or higher.

13.1.3.1. setuptools

Since we encountered some problems finding out the latest version of setuptools, the following procedure is suggested.

root@helicopter:/usr/src# wget http://peak.telecommunity.com/dist/ez_setup.py
root@helicopter:/usr/src# python ez_setup.py

13.1.3.2. PyXML

root@helicopter:~# easy_install PyXML

It is possible that an error similar to the one below is raised during the installation:

ImportError: No module named xml.sax.saxutils

It can be fixed by:

cd /usr/lib/python2.X/site-packages/PyXML-0.8.4-py2.X-linux-i686.egg
ln -s _xmlplus xml

13.1.3.3. rrdtool

If rrdtool >= 1.2.27 is already installed on your system you only need to link the python module to it:

root@unimon:~# ln -s /usr/local/rrdtool/lib/python2.5/site-packages/rrdtoolmodule.so /usr/lib/python2.5/site-packages/

To check if it worked, do:

root@hubble:~# python
Python 2.5.1 (r251:54863, May  4 2007, 16:52:23)
[GCC 4.1.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rrdtool
>>>

Older versions might be imported only as “import rrdtoolmodule”, if that is the case the library needs to be updated to the last stable release available (of the 1 series).

If rrdtool is not installed on your system you need to install it being aware that some problems related to freetype might arise. In that case here it is how to proceed:

For pinger (> 2.9.0) to work both rrd* executables and perl RRD module are needed. To check if something is missing issue:

..sourcecode:: python

perl -MRRDs -e ‘;’

If no message is given the system is ready, otherwise you need to install rrdtool. rrdtool requires freetype: to check if freetype is present in the system check if the command freetype-config is present, if it isn’t you need to install it.

Here it is an example of the freetype installation procedure:

# wget http://heanet.dl.sourceforge.net/sourceforge/freetype/freetype-2.2.1.tar.bz2
# tar xvjf freetype-2.2.1.tar.bz2
# cd freetype-2.2.1
# ./configure --prefix=/usr/local/freetype-2.2.1
# make && make install
# cd ..
# rm -rf freetype-2.2.1*
# cd /usr/local
# ln -s freetype-2.2.1 freetype
# cd bin
# ln -s ../freetype/bin/freetype-config .
# cd ..
# cd include/
# ln -s ../freetype/include/* .
# ln -s freetype2/freetype/ freetype
# cd ..
# cd lib
# ln -s ../freetype/lib/* .
# cd ..
# cd share
# mkdir aclocal
# cd aclocal
# ln -s ../../freetype/share/aclocal/freetype2.m4 .
# cd

Example of rrdtool installation procedure (beware to modify the commands to fit your system architecture and software versions):

# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.15.tar.gz
# tar xzvf rrdtool-1.2.15.tar.gz
# cd rrdtool-1.2.15
# ./configure --prefix=/usr/local/rrdtool-1.2.15
...
# make && make install
# cd ..
# rm -rf rrdtool-1.2.15*
# cd /usr/local
# ln -s rrdtool-1.2.15 rrdtool

# cd bin
# ln -s ../rrdtool/bin/* .
# cd ..

# cd include
# ln -s ../rrdtool/include/* .
# cd ..

# cd lib
# ln -s ../rrdtool/lib/lib* .
# cd ..

# cd man/man1
# ln -s ../../rrdtool/man/man1/* .
# cd ..

# cd /usr/lib/perl5/site_perl/5.8.6/i486-linux/
# ln -s /usr/local/rrdtool/lib/perl/5.8.6/i486-linux/RRDs.pm .
# cd auto
# ln -s /usr/local/rrdtool/lib/perl/5.8.6/i486-linux/auto/RRD* .
# cd

Finally execute

# perl -MRRDs -e ''

If no error message is given in output the installation was completed succesfully!

13.1.3.4. net-snmp

You can install Net-SNMP as usual. Download sources from net-snmp.org.

NOTE: You need at least version 5.5.pre2

Issue

# ./configure --prefix=/usr/local/net-snmp-5.5.pre2 && make && make install

and refer to README and INSTALL files for any problem. Then you would like to symlink produced file to default system location like this:

# cd /usr/local/
# ln -s net-snmp-5.5.pre2 net-snmp
# cd bin
# ln -s ../net-snmp/bin/* .
# cd ../lib/
# ln -s ../net-snmp/lib/* .
# cd ../sbin/
# ln -s ../net-snmp/sbin/* .
# cd ../include/
# ln -s ../net-snmp/include/* .
# cd ../share/man
# for i in 1 3 5 8; do mkdir -p man$i; cd man$i; ln -s ../../../net-snmp/share/man/man$i/* .; cd -; done

Then execute ldconfig to update your dynamic linker configuration.

FINALLY you can proceed with netsnmp python module installation. Come back to source directory and issue:

# cd python
# python setup.py build
# python setup.py install

To test module installation exit from current directory (you can go in $SANET_HOME), and try:

# python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import netsnmp
>>> netsnmp.__file__
'/usr/local/lib/python2.6/dist-packages/netsnmp_python-1.0a1-py2.6-linux-i686.egg/netsnmp/__init__.pyc'
>>> CTRL+D

You must exit from building directory because there is a netsnmp directory in it.

If you get and error try to install with:

# python setup.py install  --install-platlib /path/to/your/lib/python2.x/site-packages/

13.1.3.5. redis module

Just launch:

# easy_install redis

You can also download the module and install from source sources.

13.1.3.6. psycopg2

If EasyInstall is installed and you can access the Internet, you just need to launch:

root@helicopter:~# easy_install psycopg2

otherwise it can be installed the usula way:

root@clarabella:~# wget http://www.initd.org/pub/software/psycopg/psycopg2-2.0.7.tar.gz
root@clarabella:~# tar xzvf psycopg2-2.0.7.tar.gz
root@clarabella:~# cd psycopg2-2.0.7
root@clarabella:~/psycopg2-2.0.7# python setup.py install
root@clarabella:~# rm -rf psycopg2-2.0.7*

13.1.3.7. pydot

If SANET is being installed on a slackware system, the following libraries are needed: libX11-1.1.4-i486-1.tgz libXau-1.0.3-i486-1.tgz libXdmcp-1.0.2-i486-1.tgz libXpm-3.5.7-i486-1.tgz libxcb-1.0-i486-2.tgz

Then the SANET_HOME variable, containing the path to the SANET directory, has to be exported as an environment variable:

export SANET_HOME=/usr/local/sanet

and added to /etc/profile

If setuptools have bbe installed as described above, and graphviz is already installed on your system, you can install pydot by:

root@mason:~# easy_install pydot

Otherwise you need to install Graphviz-

13.1.3.8. Graphviz

To install Graphviz the dev library .la libexpat is needed, if it is not present and you are using a slackware system it can be installed as a slackware package, categoty “L”. The same holds for jpeg, fontconfig, and freetype). Once the needed libraries and packages are installed, the graphviz installation procedure is as follows:

root@melkor:~# wget http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-2.20.2.tar.gz
root@hubble:~# tar xzvf graphviz-2.20.2.tar.gz
root@hubble:~# cd graphviz-2.20.2
root@hubble:~/graphviz-2.20.2# ./configure --prefix=/usr/local/graphviz-2.20.2 && make && make install
root@hubble:~/graphviz-2.20.2# cd /usr/local
root@hubble:/usr/local# ln -s graphviz-2.20.2 graphviz
root@hubble:/usr/local# cd bin
root@hubble:/usr/local/bin# ln -s ../graphviz/bin/* .
root@hubble:/usr/local/bin# cd ..
root@hubble:/usr/local# cd lib
root@hubble:/usr/local/lib# ln -s ../graphviz/lib/* .
root@hubble:/usr/local/lib# cd ..
root@hubble:/usr/local# cd include/
root@hubble:/usr/local/include# ln -s ../graphviz/include/graphviz .
root@hubble:/usr/local/include# cd ..
root@hubble:/usr/local# cd man
root@hubble:/usr/local/man# for i in 1 3 n
> do
> cd man$i
> ln -s ../../graphviz/share/man/man$i/* .
> cd ..
> done
root@hubble:/usr/local/man# cd
root@hubble:~# rm  -rf graphviz-2.20.2*

Then pyparsing needs to be installed:

root@melkor:~# wget http://switch.dl.sourceforge.net/sourceforge/pyparsing/pyparsing-1.5.0.tar.gz
root@hubble:~# tar xzf pyparsing-1.5.0.tar.gz
root@hubble:~# cd pyparsing-1.5.0
root@hubble:~/pyparsing-1.5.0# python setup.py install
root@hubble:~/pyparsing-1.5.0# cd ..
root@hubble:~# rm -rf pyparsing-1.5.0*

And finally pydot:

root@melkor:~# wget http://pydot.googlecode.com/files/pydot-1.0.2.tar.gz
root@hubble:~# tar xzf pydot-1.0.2.tar.gz
root@hubble:~# cd pydot-1.0.2
root@hubble:~/pydot-1.0.2# python setup.py install
root@hubble:~/pydot-1.0.2# cd ..
root@hubble:~# rm -rf pydot-1.0.2*

13.1.3.9. antlr3

Antlr3 is not available via easy install. The python runtime can be daownlaoded from http://www.antlr.org/download/Python/antlr_python_r untime-3.1.2.tar.gz (python 2.4 o 2.5 or newer, http://www.antlr.org/download/Python)

# tar xzvf antlr_python_runtime-3.1.2.tar.gz
# cd antlr_python_runtime-3.1.2
# python setup.py install
# cd ..
# rm -rf antlr_python_runtime-3.1.2*

13.1.3.10. ReportLab library

Download the ReportLab version 2.3 or newer from the ReportLab download page

Here it is a direct link to version 2.3:: ReportLab_2_3

Installation procedure:

# wget http://www.reportlab.org/ftp/ReportLab_2_3.tar.gz
# tar -xzvf ReportLab_2_3.tar.gz
# cd ReportLab_2_3
# python setup.py tests-preinstall  (dovrebbero esserci degli errori)
# python setup.py install
# python setup.py tests

Download the required fonts from here

Unzip the package and copy the files in the directory (create it if missing):

/usr/lib/<python-2.*>/site-packages/reportlab/fonts/

For more info look at: http://bioinf.scri.ac.uk/lp/downloads/programs/genomediagram/renderPM_help.txt

13.1.3.11. Pil library

Download the package from the Pil homepage

It requires libjpeg library version 6a or 6b. It should already be present in the default installation.

Here it is a direct link: http://effbot.org/downloads/Imaging-1.1.6.tar.gz

Installation procedure:

$ tar -xzvf Imaging-1.1.6.tar.gz
$ cd Imaging-1.1.6
$ python setup.py build
$ python setup.py install

13.1.3.12. Html5lib library

This library can be installed via Easy Install by issuing:

# easy_install html5lib

13.1.3.13. Pisa library

Pisa can be installed via Easy Install by issuing:

# easy_install pisa

13.1.4. PERL e RDTOOL modules

SANET comes with the latest pinger version. If an older pinger version is used some modules might be missing.

To check if you are missing perl modules, issue:

# pinger -h

If you get errors like Can’t locate somedir/somemodule.pm in @INC ... you need to download them from http://www.cpan.org or install them using cpan by issuing:

"perl -MCPAN -e shell".

13.1.4.1. RRDTool

Pinger versions > 2.9.0 needs rrd* executable files and the RRD Perl module to work. If the command:

# perl -MRRDs -e ';'

does not give any output everything is fine, otherwise it has to be installed. To install RRDTool freetype is needed. If the command:

# freetype-config

everything is alright, otherwise it needs to be installed.

Here it is an example of freetype installation (please notice that:

# wget http://heanet.dl.sourceforge.net/sourceforge/freetype/freetype-2.2.1.tar.bz2
# tar xvjf freetype-2.2.1.tar.bz2
# cd freetype-2.2.1
# ./configure --prefix=/usr/local/freetype-2.2.1
# make && make install
# cd ..
# rm -rf freetype-2.2.1*
# cd /usr/local
# ln -s freetype-2.2.1 freetype
# cd bin
# ln -s ../freetype/bin/freetype-config .
# cd ..
# cd include/
# ln -s ../freetype/include/* .
# ln -s freetype2/freetype/ freetype
# cd ..
# cd lib
# ln -s ../freetype/lib/* .
# cd ..
# cd share
# mkdir aclocal
# cd aclocal
# ln -s ../../freetype/share/aclocal/freetype2.m4 .
# cd

Here it is an example of rrdtool installation:

# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.15.tar.gz
# tar xzvf rrdtool-1.2.15.tar.gz
# cd rrdtool-1.2.15
# ./configure --prefix=/usr/local/rrdtool-1.2.15
...
# make && make install
# cd ..
# rm -rf rrdtool-1.2.15*
# cd /usr/local
# ln -s rrdtool-1.2.15 rrdtool

# cd bin
# ln -s ../rrdtool/bin/* .
# cd ..

# cd include
# ln -s ../rrdtool/include/* .
# cd ..

# cd lib
# ln -s ../rrdtool/lib/lib* .
# cd ..

# cd man/man1
# ln -s ../../rrdtool/man/man1/* .
# cd ..

# cd /usr/lib/perl5/site_perl/5.8.6/i486-linux/ # Change it according to your system's architecture
# ln -s /usr/local/rrdtool/lib/perl/5.8.6/i486-linux/RRDs.pm . # Change it according to your system's architecture
# cd auto
# ln -s /usr/local/rrdtool/lib/perl/5.8.6/i486-linux/auto/RRD* . # Change it according to your system's architecture
# cd
# perl -MRRDs -e ''

If the command:

# perl -MRRDs -e ''

does not give any output, then RRDTool is installed correctly.

13.1.4.1.1. Apache 2.x

Apache 2.x with mod_python is needed. The basic Apache 2 installation usually works excpet mod_python that usually is not included in the default installation.

13.1.4.2. Apache installation

root@unimon:~# wget http://www.eu.apache.org/dist/httpd/httpd-2.2.9.tar.bz2
root@unimon:~# tar xjvf httpd-2.2.9.tar.bz2
root@unimon:~# cd httpd-2.2.9
root@unimon:~/httpd-2.2.9# ./configure --prefix=/usr/local/httpd-2.2.9/ --enable-mods-shared="all" --enable-ssl && make && make install

If something goes wrong try removing not needed modules (the only module needed by SANET is mod_python).

root@unimon:~/httpd-2.2.9# cd ..
root@unimon:~# rm -rf httpd-2.2.9*
root@unimon:~# cd /usr/local

Note: on some machine it might be needed to install db44-4.4.20-i486-2.tgz and expat-2.0.1-i486-1.tgz, for slackware distribution they are available at packages.slackware.it

13.1.4.3. mod_python installation

Check that python 2.4 or newer is installed.

mod_python does not need –prefix, on the other hand if many apache instances are installed it is fundamental to give the right apxs value to choose the apache instance to use.

root@unimon:~# wget http://www.eu.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz
root@unimon:~# tar xzvf mod_python-3.3.1.tgz
root@unimon:~# cd mod_python-3.3.1
root@unimon:~/mod_python-3.3.1# ./configure --with-apxs=/usr/local/httpd-2.2.9/bin/apxs && make && make install
root@unimon:~/mod_python-3.3.1# cd ..
root@unimon:~# rm -rf mod_python-3.3.1*

13.1.4.4. Django

You need Django version 1.2 or higher. You can just use easy_install or download it from http://www.djangoproject.com/download/ and install following its documentation.