Differences

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

Link to this comparison view

installing_and_configuring_squidanalyzer_on_debian_jessie_en [2017/09/05 12:18] (current)
Line 1: Line 1:
 +====== ​ 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.
 +
 +<sxh bash>
 +aptitude install build-essential apache2 git -y
 +</​sxh>​
 +
 +Now we need to access the /​var/​www/​html and let's get the squidanalyzer from the github
 +<sxh bash>
 +cd /​var/​www/​html/​
 +git clone https://​github.com/​darold/​squidanalyzer.git
 +</​sxh>​
 +
 +Now we need to rename the squidanalyzer directory ​
 +<sxh bash>
 +mv squidanalyzer squidanalyzer-sources
 +</​sxh>​
 +
 +Now we need to access the squidanalyzer-sources directory
 +<sxh bash>
 +cd squidanalyzer-sources
 +</​sxh>​
 +
 +Now we need to configure the Makefile.PL as follow
 +<sxh bash>
 +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
 +</​sxh>​
 +
 +Now we need to run the make of squidanalyzer
 +<sxh bash>
 +make
 +</​sxh>​
 +
 +Now we need to run the make install
 +<sxh bash>
 +make install
 +</​sxh>​
 +
 +Now we need to copy the images from squidanalyzer-sources to the html directory
 +<sxh bash>
 +cp -Rfa /​var/​www/​html/​squidanalyzer-sources/​resources/​images/​* /​var/​www/​html/​squidanalyzer/​images/​
 +</​sxh>​
 +
 +Now we need to configure the global variables as follow, here only make sure that all the configurations are as mine.
 +<sxh apache>
 +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
 +[...]
 +</​sxh>​
 +
 +Now we need to create a virtualhost to squidanalyzer as follow
 +<sxh apache>
 +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>​
 +</​sxh>​
 +
 +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
 +<sxh bash>
 +mkdir /​etc/​apache2/​access/​
 +</​sxh>​
 +
 +Now we need to create the username and password to access the SquidAnalyzer
 +<sxh bash>
 +htpasswd -s -c /​etc/​apache2/​access/​squidanalyzer-htpasswd squidanalyzer
 +New password: ​
 +Re-type new password: ​
 +Adding password for user squidanalyzer
 +</​sxh>​
 +
 +Now we need to disable the default virtualhost
 +<sxh bash>
 +a2dissite 000-default
 +</​sxh>​
 +
 +Let's enable the configuration of lightsquid
 +<sxh bash>
 +a2ensite squidanalyzer.conf
 +</​sxh>​
 +
 +We need to configure now the crontab to update the SquidAnalyzer,​ here I will configure the schedule to update the SquidAnalyzer every 10 minutes. ​
 +<sxh bash>
 +crontab -e
 +0 */10     ​* ​      ​* ​      ​* ​   /​usr/​bin/​squid-analyzer > /dev/null 2>&1
 +</​sxh>​
 +
 +Now let's create the first one report
 +<sxh bash>
 +/​usr/​bin/​squid-analyzer > /dev/null 2>&1
 +</​sxh>​
 +
 +Now we need to restart the Apache service
 +<sxh bash>
 +/​etc/​init.d/​apache2 restart
 +</​sxh>​
 +
 +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
 +
 +{{::​squid-analyzer-01.png?​500|}}
 +
 +Here if you select **Stat 2015*** we can get something like this
 +
 +
 +{{::​squid-analyzer-02.png?​500|}}
 +
 +
 +The SquidAnalyzer is very interactive web interface.
 +
 +====== References ======
 +  - https://​github.com/​darold/​squidanalyzer
 +  - http://​squidanalyzer.darold.net/​config.html