How to Install AWStat on Ubuntu 15.10

To Install AWStat in Ubuntu 15.10

AWStats is an open source tool that generates advanced web, streaming and mail server statistics. Log analyser will act as a CGI to display all the log information in the graphical web pages. Installation of AWStat tool on Ubuntu 15.10 is discussed in this article.

Features

  • Number of visits and number of unique visitors.
  • Visits duration and last visits.
  • Authenticated users and last authenticated visits.
  • Hosts list, last visits and unresolved IP addresses list.
  • Most viewed, entry and exit pages.
  • Cluster report for load balanced servers ratio.

Installation of AWStat Tool

Before AWStat installation process, install the LAMP setup. To know how to install LAMP visit,
https://www.linuxhelp.com/how-to-install-lamp-setup-in-ubuntu-15-10/
Now download the AWStat package with the below command.

root@user1-linuhelp:/home/user1/Desktop# wget http://prdownloads.sourceforge.net/awstats/awstats-7.3.tar.gz
--2016-08-05 18:24:11-- http://prdownloads.sourceforge.net/awstats/awstats-7.3.tar.gz
Resolving prdownloads.sourceforge.net (prdownloads.sourceforge.net)... 216.34.181.59
Connecting to prdownloads.sourceforge.net (prdownloads.sourceforge.net)|216.34.181.59|:80... connected.
.
.
.
awstats-7.3.tar.gz 100%[============================================> ] 2.76M 392KB/s in 13s
2016-08-05 18:24:26 (219 KB/s) - ‘ awstats-7.3.tar.gz’  saved [2897463/2897463]

Next, extract the downloaded package.

root@user1-linuhelp:/home/user1/Desktop# tar -xvzf awstats-7.3.tar.gz
awstats-7.3/
awstats-7.3/tools/
awstats-7.3/tools/awstats_buildstaticpages.pl
awstats-7.3/tools/awstats_updateall.pl
.
.
.
awstats-7.3/docs/awstats_config.html
awstats-7.3/README.TXT

Copy the downloaded directory into following location by using below command.

root@user1-linuhelp:/home/user1/Desktop/awstats-7.3/wwwroot# cp -r icon /var/www/html/
root@user1-linuhelp:/home/user1/Desktop/awstats-7.3/wwwroot# chown www-data:www-data -R /var/www/html/icon/

Now enable the cgi service with following command.

root@user1-linuhelp:/home/user1/Desktop/awstats-7.3/wwwroot# a2enmod cgi
AH00558: apache2: Could not reliably determine the server' s fully qualified domain name, using 127.0.1.1. Set the ' ServerName'  directive globally to suppress this message
Enabling module cgi.

Restart the apache2 service using below command to activate the new configuration.

root@user1-linuhelp:/home/user1/Desktop/awstats-7.3/wwwroot# service apache2 restart

Its time to move the cgi-bin directory into new awstat directory.

root@user1-linuhelp:/home/user1/Desktop/awstats-7.3/wwwroot# mv cgi-bin awstat

Change the ownership for awstat directory using below command.

root@user1-linuhelp:/home/user1/Desktop/awstats-7.3/wwwroot# chown www-data:www-data -R awstat

Move the awstat directory to ‘ /usr/lib/cgi-bin’ location.

root@user1-linuhelp:/home/user1# mv awstat /usr/lib/cgi-bin
root@user1-linuhelp:/home/user1# cd /usr/lib/cgi-bin/awstat

Copy the awstats.model.conf file as given below.

root@user1-linuhelp:/home/user1# cp awstats.model.conf awstats.linux.conf

Now open the copied file and make the changes with following statements.

root@user1-linuhelp:/home/user1# nano awstats.linux.conf
LogFile=" /var/log/apache2/access.log" 
SiteDomain=" www.linuxhelp.com" 
AllowToUpdateStatsFromBrowser=1

Finally, create the stat for AWStat using following command.

root@user1-linuhelp:/home/user1# /usr/bin/perl /usr/lib/cgi-bin/awstat/awstats.pl -config=linux -update
Create/Update database for config " /usr/lib/cgi-bin/awstat/awstats.linux.conf"  by AWStats version 7.3 (build 20140126)
From data in log file " /var/log/apache2/access.log" ...
Phase 1 : First bypass old records, searching new record...
.
.
.
Found 0 old records,
Found 54 new qualified records.

After the above process, open the web-browser and enter ip address with the awstat location path.

Home page of AWStat will appear as given below. Here you can monitor the log activities of your server.

Tag : AWStat
FAQ
Q
Which Log Format can AWStats analyze?
A
In AWStats, you can define your own log format, that's the reason why AWStats can analyze nearly all web, wap and proxy server log files. Some FTP servers log files, Syslog or mail logs can also be analyzed. The only requirement is "Your log file must contain required information"
Q
What is the installation procedure for AWStats in Debian Os?
A
The installation procedure for AWStats on Debian OS remains the same as the procedure involved for Ubuntu
Q
How to overcome the 403 Forbidden Error after AWStats installation?
A
To avoid 403 Forbidden issue provide appropriate owner and group permission and also executable permission for the document root location.
Q
What does the /usr/lib/ consist of Awstats?
A
The /usr/lib/ in AWStats comprises of machines library file so that is why AWStats moved to another location.
Q
Is it fine to provide apache access logs in the AWStats conf file?
A
Yes, you need to provide apache access log into it since it is running via Apache web server.