TraffStats is distributed in different ways (state of the art for version 0.10.2):
1.2.1 Installing the core version
Download the current version of TraffStats and extract the archive
into a directory accessible through your webserver. e.g.
/var/www/:
tar xz -f TraffStats-0.10.2-core.tgz -C /var/www/
In order to simplify the URL for the access of the webapplication you may create
a link to the
TraffStats-0.10.2-directory:
ln -sv /var/www/TraffStats-0.10.2/ /var/www/traffstats
Change into the TraffStats-directory; all examples in this HowTo assume
that your working directory is the newly created TraffStats-directory.
cd /var/www/TraffStats-0.10.2
If you have installed an old version of TraffStats and prefer a complete
new installation instead of an upgrade, you must delete the old database
and user. If you prefer an upgrade, please read
Upgrade.
There are 2 scripts that should help you deleting the old database and the old database-user.
(
Attention: do not execute the following commands if you like to do an upgrade!)
mysql -u root -p < sql/99_dropdatabase.sql;
mysql -u root -p < sql/99_dropuser.sql;
Create the database:
(
Attention: do not execute the following commands if you like to do an upgrade!)
Use the commands listed below to create the database and the database-user:
mysql -u root -p < sql/00_create-traffstats-db.sql;
mysql -u root -p < sql/01_createuser.sql;
Adjusting file rights
Files containing sensitive informations should be secured
by assigning them restrictive user rights.
The file
config/config.php
should only be readable by the useraccount used by the webserver. e.g.:
chown root.www-data config/config.php;
chmod 640 config/config.php;
The file
collector/collector.pl
should only be read- and executable by the account running
the cronjob for the collector (root). e.g.:
chown root collector/*.pl;
chmod 700 collector/*.pl;
1.2.1.1 Additional Software - JPGraph
In order to use all functions of TraffStats you should install JpGraph.
JpGraph can be downloaded form
http://www.aditus.nu/jpgraph/jpdownload.php.
JpGraph is distributed in 2 different series / versions:
Version 1.x for PHP4 and 2.x for PHP5.
Please download the version corresponding to your PHP version.
In case you have already downloaded and installed JpGraph, you may
find informations on how to make this available for TraffStats by reading
"Installing JpGraph into an external directory".
In order to install JpGraph you have 2 possibilities:
-
Installing JpGraph into the TraffStats directory
This is the recommended way if you like to use JpGraph only for TraffStats.
Extract the downloaded JpGraph file and create a symbolic link
jpgraph
to the src-subdirectory of the
JpGraph-directory:
tar xz -f jpgraph-x.y.tar.gz;
ln -sv jpgraph-x.y/src/ jpgraph;
(please replace in both commands x.y with the JpGraph version number)
-
Installing JpGraph into an external directory:
This is the recommended way if you like to use JpGraph for TraffStats
and for other projects.
Extract the downloaded JpGraph file into a external directory
(e.g.: /usr/local/share/jpgraph-x.y
whereby x.y should be replaced with the JpGraph version number)
tar xz -f jpgraph-x.y.tar.gz -C /usr/local/share/;
Now there are 2 ways how to use the JpGraph-Installation for TraffStats:
(please replace in both commands x.y with the JpGraph version number)
-
Create a symbolic link
jpgraph
targeting the
src-directory of the JpGraph installation
into the TraffStats directory:
ln -sv /usr/local/share/jpgraph-x.y/src/ jpgraph;
-
Edit the file config/graphconfig.php
and change the value of the variable
TRAFFSTATS__JPGRAPH
define("TRAFFSTATS__JPGRAPH", "/usr/local/share/jpgraph-x.y/src/");
1.2.1.2 Additional Software - Microsoft TrueType core fonts
You can find the required fonts on
corefonts.sourceforge.net
TraffStats requires Arial und Courier to corectly display UTF chars in the graphs.
cabextract may be found on
www.cabextract.org.uk
mkdir ttf;
cd ttf;
wget http://downloads.sourceforge.net/corefonts/arial32.exe;
wget http://downloads.sourceforge.net/corefonts/courie32.exe;
cabextract -q arial32.exe;
cabextract -q courie32.exe;
for i in Arial*.TTF; do LCF=`echo $i | tr [:upper:] [:lower:]`; ln -sv $i $LCF; done;
If you have allready installed the fonts int another directory you have 2 possibilities:
-
Create a symbolic link
jpgraph
targeting the directory where the ttf-files can be found into the TraffStats directory:
ln -sv /usr/share/fonts/truetype/msttcorefonts ttf;
-
Edit the file config/graphconfig.php
and adjust the value of the variable TTF_DIR:
define("TTF_DIR", "/usr/share/fonts/truetype/msttcorefonts/");
1.2.3 Installation using deb-Packages
The
deb-Packages have been developed for Debian etch (4.0).
Tests for the distributions testing and unstable (lenny and sid)
are still pending.
A experimantal repository exists.
If you like to use it, please add the following line to
your
/etc/apt/sources.list:
deb http://zero-sys.net/deb/traffstats/ ./
Please enter the following commands as
root
in order to import the key used for signing the packages and the repository:
gpg --keyserver subkeys.pgp.net --recv-key ED7D414C ;
gpg --export --armor ED7D414C | apt-key add - ;
List of distributed files (deb-packages):
- traffstats_0.10.2_all.deb - traffstats
- JpGraph 2.x for PHP5
- libphp-jpgraph2_2.3-1_all.deb
- libphp-jpgraph2-examples_2.3-1_all.deb
- libphp-jpgraph2-doc_2.3-1_all.deb
- JpGraph 1.x for PHP4
- libphp-jpgraph1_1.22-3_all.deb
- libphp-jpgraph1-examples_1.22-3_all.deb
In order to install TraffStats for PHP5 you must download
traffstats_0.10.2_all.deb and
libphp-jpgraph2_2.3-1_all.deb.
Then first install all required packages:
apt-get install apache2 php5 libapache2-mod-php5 php5-gd php5-snmp php5-mysql \
libnet-snmp-perl libdbd-mysql-perl debianutils dbconfig-common debconf ucf \
mysql-server msttcorefonts
Install JpGraph:
dpkg -i libphp-jpgraph2_2.3-1_all.deb
If you prefer using the repository:
apt-get install libphp-jpgraph2
Finally install TraffStats:
dpkg -i traffstats_0.10.2_all.deb
or via the repository:
apt-get install traffstats
The procedure for PHP4 would be similar:
Download the required files:
traffstats_0.10.2_all.deb and
libphp-jpgraph1_1.22-3_all.deb.
Then first install all required packages:
apt-get install apache2 php4 libapache2-mod-php4 php4-gd php4-snmp php4-mysql \
libnet-snmp-perl libdbd-mysql-perl debianutils dbconfig-common debconf ucf \
mysql-server msttcorefonts
Install JpGraph:
dpkg -i libphp-jpgraph1_1.22-3_all.deb
If you prefer using the repository:
apt-get install libphp-jpgraph1
Finally install TraffStats:
dpkg -i traffstats_0.10.2_all.deb
or via the repository:
apt-get install traffstats
During the installation of the TraffStats package
you can let the install routines automatical create the required databases
and perform the necessary configuration of the web server.
If you should choose this comfortable way, you can continue right after
the installation with the
First login.