Installing and Configuring AWStats on RHEL 6

AWStats is a free (as in beer) log analysis solution for web sites.

While Red Hat does not ship an rpm package for this software with RHEL 6, one is available from EPEL.


Use yum to install the latest awstats rpm and any dependencies.

The resulting setup will place configuration and support files under:

/etc/httpd/conf.d (an awstats.conf sets up the aliases needed to publish results)

/etc/awstats (site configuration files are here)

/usr/share/awstats (this is where most of the application files are located)

/etc/cron.hourly (an awstats script here kicks off an hourly update)

/var/lib/awstats (this is where the db files are kept, defined in each site conf file by “DirData=”).

My recommendation is that you leave these where they are until you’ve worked with the software for awhile.


The EPEL packager has already done most of the work for you. Follow the steps below to finish the configuration.

In the examples that follow the site name is and its access log is /var/log/httpd/

1. Make sure your set your access log type for your virtual hosts in /etc/httpd/conf/httpd.conf to “combined”, thus:

    DocumentRoot /var/www/html
    ErrorLog logs/
    CustomLog logs/ combined

2. Create a new site configuration file under /etc/awstats by copying the existing awstats.model.conf and naming it for your site. For example:

cd /etc/awstats
cp awstats.model.conf

3. Edit the new configuration file to set the LogFile, SiteDomain and HostAliases to your site’s real values:

* * *
* * *

4. Go into /etc/httpd/conf.d/awstats.conf and add your local DNS domain (and/or any desired subnet) to allow users on your network but not on the web server itself to access awstats:

Allow from
Allow from
Allow from

5. Shut down your web server.

service httpd stop

6. Remove all existing logs that may have been generated with the “common” log format, awstats will choke on these and refuse to commit anything.

7. Restart the web server.

service httpd start

8. Initialize the database by invoking the script (found under /usr/share/awstats/wwwroot/cgi-bin) with the following syntax:

perl -update

The script should kick back something like the following:

Create/Update database for config "/etc/awstats/"
 by AWStats version 7.0 (build 1.971)
From data in log file "/var/log/httpd/"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 214
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 214 new qualified records.


Test by going to the awstats url for your site. For example: