How To Install Squid Analyzer On Centos 7
To Install Squid Analyzer On Centos 7
Squid Analyzer is used to monitor Squid Proxy Server. Squid proxy native log analyser and reports generator with full statistics about times, hits, bytes, users, networks, top urls and top domains. Statistic reports are oriented toward user and bandwidth control; this is not a pure cache statistics generator. SquidAnalyzer use flat files to store data and don't need any SQL, SQL Lite or Berkeley databases.This log analyzer is incremental and should be run in a daily cron or more often on huge network trafic. In this tutorial, we will cover the installation of squid analyzer on centos 7.
Pre-requirements
• Squid
• Apache Web Server (httpd)
• Perl
Installation
\[root@linuxhelp11 ~\]# yum install perl perl-devel -y Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
\* base: mirror.vbctv.in
\* extras: mirror.vbctv.in
\* updates: mirror.vbctv.in
Package 4:perl-5.16.3-292.el7.x86\_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package perl-devel.x86\_64 4:5.16.3-292.el7 will be installed
--> Processing Dependency: systemtap-sdt-devel for package: 4:perl-devel-5.16.3-292.el7.x86\_64
--> Processing Dependency: perl(ExtUtils::ParseXS) for package: 4:perl-devel-5.16.3-292.el7.x86\_64
--> Processing Dependency: perl(ExtUtils::MakeMaker) for package: 4:perl-devel-5.16.3-292.el7.x86\_64
--> Processing Dependency: perl(ExtUtils::Installed) for package: 4:perl-devel-5.16.3-292.el7.x86\_64
--> Processing Dependency: libdb-devel for package: 4:perl-devel-5.16.3-292.el7.x86\_64
--> Processing Dependency: glibc-devel for package: 4:perl-devel-5.16.3-292.el7.x86\_64
.
.
.
Dependency Updated:
glibc.x86\_64 0:2.17-222.el7 glibc-common.x86\_64 0:2.17-222.el7 libdb.x86\_64 0:5.3.21-24.el7 libdb-utils.x86\_64 0:5.3.21-24.el7
Complete!
Download Squid-analyzer using following command
[root@linuxhelp11 ~\]# wget https://sourceforge.net/projects/squid-report/files/latest/download -O squidanalyzer.tar.gz \--2018-08-31 03:10:27-- https://sourceforge.net/projects/squid-report/files/latest/download
Resolving sourceforge.net (sourceforge.net)... 216.105.38.13
Connecting to sourceforge.net (sourceforge.net)|216.105.38.13|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://downloads.sourceforge.net/project/squid-report/squid-report/6.6/squidanalyzer-6.6.tar.gz?r=&ts=1535665118&use\_mirror=excellmedia \[following\]
--2018-08-31 03:10:28-- https://downloads.sourceforge.net/project/squid-report/squid-report/6.6/squidanalyzer-6.6.tar.gz?r=&ts=1535665118&use\_mirror=excellmedia
Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 216.105.38.13
Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|216.105.38.13|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://excellmedia.dl.sourceforge.net/project/squid-report/squid-report/6.6/squidanalyzer-6.6.tar.gz \[following\]
--2018-08-31 03:10:29-- https://excellmedia.dl.sourceforge.net/project/squid-report/squid-report/6.6/squidanalyzer-6.6.tar.gz
Resolving excellmedia.dl.sourceforge.net (excellmedia.dl.sourceforge.net)... 202.153.32.19
Connecting to excellmedia.dl.sourceforge.net (excellmedia.dl.sourceforge.net)|202.153.32.19|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 170053 (166K) \[application/x-gzip\]
Saving to: ‘squidanalyzer.tar.gz’
100%\[==================================================================================================>\] 170,053 1011KB/s in 0.2s
2018-08-31 03:10:29 (1011 KB/s) - ‘squidanalyzer.tar.gz’ saved \[170053/170053\]
Extract the downloaded file .
[root@linuxhelp11 ~\]# tar -xvf squidanalyzer.tar.gz
squidanalyzer-6.6/
squidanalyzer-6.6/ChangeLog
squidanalyzer-6.6/INSTALL
squidanalyzer-6.6/etc/
squidanalyzer-6.6/etc/included
squidanalyzer-6.6/etc/user-aliases
squidanalyzer-6.6/etc/squidanalyzer.conf
squidanalyzer-6.6/etc/network-aliases
.
.
.
squidanalyzer-6.6/packaging/
squidanalyzer-6.6/packaging/RPM/
squidanalyzer-6.6/packaging/RPM/squidanalyzer.spec
enter into extracted Directory and execute perl script file using perl
[root@linuxhelp11 ~\]# cd squidanalyzer-6.6
[root@linuxhelp11 squidanalyzer-6.6\]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for SquidAnalyzer
Done...
Now type 'make && make install'
Compile using make command
[root@linuxhelp11 squidanalyzer-6.6\]# make
cp SquidAnalyzer.pm blib/lib/SquidAnalyzer.pm
cp squid-analyzer blib/script/squid-analyzer
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/squid-analyzer
Manifying blib/man3/SquidAnalyzer.3pm
Install Squid analyzer using “Make install” command
[root@linuxhelp11 squidanalyzer-6.6\]# make install
Installing /usr/local/share/perl5/SquidAnalyzer.pm
Installing /usr/local/share/man/man3/SquidAnalyzer.3pm
Installing /usr/local/bin/squid-analyzer
sh install\_all.sh
-----------------------------------------------------------------------------
1. Modify your httpd.conf to allow access to HTML output like follow:
Alias /squidreport /var/www/squidanalyzer
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.1
2. If necessary, give additional host access to SquidAnalyzer in httpd.conf.
Restart and ensure that httpd is running.
3. Browse to http://my.host.dom/squidreport/ to ensure that things are working
properly.
4. Setup a cronjob to run squid-analyzer daily:
# SquidAnalyzer log reporting daily
0 2 \* \* \* /usr/local/bin/squid-analyzer > /dev/null 2>&1
or run it manually. For more information, see /README file.
-----------------------------------------------------------------------------
Appending installation info to /usr/lib64/perl5/perllocal.pod
Create new virtualhost with specified content which shows while installing
[root@linuxhelp11 squidanalyzer-6.6\]# vim /etc/httpd/conf.d/squidanalyzer.conf
Alias /squidreport /var/www/squidanalyzer
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.1
Restart the apache web server
[root@linuxhelp11 squidanalyzer-6.6\]# systemctl restart httpd
Open a browser ,and give the url as “http://127.0.0.1/squidreport”. It will opens the squid analyzer web console.
tailf /var/log/squid/access.log | grep 192.168.5.30
systemctl reload squid.service