Installing and Configuring SquidAnalyzer on Debian Jessie
What's up folks, so here I will show you how to configure SquidAnalyzer on Debian Jessie, I think it is pretty easy.
Prepare your system with the following shell script http://wiki.douglasqsantos.com.br/doku.php/confinicialjessie_en if you do not use this script please, be aware that can be some problems during the progress.
Let's install some packets that we need to configure properly the SquidAnalyzer.
aptitude install build-essential apache2 git -y
Now we need to access the /var/www/html and let's get the squidanalyzer from the github
cd /var/www/html/ git clone https://github.com/darold/squidanalyzer.git
Now we need to rename the squidanalyzer directory
mv squidanalyzer squidanalyzer-sources
Now we need to access the squidanalyzer-sources directory
cd squidanalyzer-sources
Now we need to configure the Makefile.PL as follow
perl Makefile.PL \ LOGFILE=/var/log/squid3/access.log \ BINDIR=/usr/bin \ CONFDIR=/etc/squidanalyzer \ HTMLDIR=/var/www/html/squidanalyzer \ BASEURL=/ \ MANDIR=/usr/man/man3 \ DOCDIR=/usr/share/doc/squidanalyzer
Now we need to run the make of squidanalyzer
make
Now we need to run the make install
make install
Now we need to copy the images from squidanalyzer-sources to the html directory
cp -Rfa /var/www/html/squidanalyzer-sources/resources/images/* /var/www/html/squidanalyzer/images/
Now we need to configure the global variables as follow, here only make sure that all the configurations are as mine.
vim /etc/squidanalyzer/squidanalyzer.conf [...] # The document root of the squidanalyzer Output /var/www/html/squidanalyzer [...] # Here we need to set up the WebUrl where the system will get the images and script WebUrl / [...] # Here we need to set up the access.log from squid, if you are using another location please choose your own. LogFile /var/log/squid3/access.log [...] NetworkAlias /etc/squidanalyzer/network-aliases [...] UserAlias /etc/squidanalyzer/user-aliases [...] #Here we can use the following languages #ca_CA.txt cs_CZ.txt de_DE.txt en_US.txt es_ES.txt fr_FR.txt it_IT.txt pl_PL.txt pt_BR.txt ru_RU.txt uk_UA.txt Lang /etc/squidanalyzer/lang/en_US.txt [...] # The date format you can choose your own DateFormat %d-%m-%y [...]
Now we need to create a virtualhost to squidanalyzer as follow
vim /etc/apache2/sites-available/squidanalyzer.conf <VirtualHost *:80> ServerName squidanalyzer.douglasqsantos.com.br ServerAdmin webmaster@douglasqsantos.com.br DocumentRoot "/var/www/squidanalyzer" <Directory "/var/www/squidanalyzer"> Options +FollowSymLinks +FollowSymLinks +MultiViews AllowOverride All AuthUserFile /etc/apache2/access/squidanalyzer-htpasswd AuthName "SquidAnalyzer" AuthType Basic require valid-user </Directory> ServerSignature Off LogLevel info ErrorLog /var/log/apache2/squidanalyzer-error.log CustomLog /var/log/apache2/squidanalyzer-access.log combined </VirtualHost>
Now we need to create the AuthUserFile because the SquidAnalyzer does not has a authentication page.
We need to create the directory that will store the file
mkdir /etc/apache2/access/
Now we need to create the username and password to access the SquidAnalyzer
htpasswd -s -c /etc/apache2/access/squidanalyzer-htpasswd squidanalyzer New password: Re-type new password: Adding password for user squidanalyzer
Now we need to disable the default virtualhost
a2dissite 000-default
Let's enable the configuration of lightsquid
a2ensite squidanalyzer.conf
We need to configure now the crontab to update the SquidAnalyzer, here I will configure the schedule to update the SquidAnalyzer every 10 minutes.
crontab -e 0 */10 * * * /usr/bin/squid-analyzer > /dev/null 2>&1
Now let's create the first one report
/usr/bin/squid-analyzer > /dev/null 2>&1
Now we need to restart the Apache service
/etc/init.d/apache2 restart
Now we can use the web interface to get information about user access in http://squidanalyzer.douglasqsantos.com.br or http://ip_servidor
After login we will get something like below
Here if you select Stat 2015* we can get something like this
The SquidAnalyzer is very interactive web interface.