Installing AWStats on Linux

Installing AWStats is unfortunately not as straight forward as one might like. This article will walk you through the process.

First of all, download the latest tar.gz package from the AWStats homepage. After downloading, extract the package to /usr/local/awstats and change the ownership of the AWStats directory to the Apache user (on Debian based systems, this is www-data).

sudo tar -xzf /path/to/downloaded/awstats-version.tar.gz -C /usr/local
sudo mv /usr/local/awstats-* /usr/local/awstats
sudo chown -R www-data:www-data /usr/local/awstats

Add the following to your apache configuration file, usually located in /etc/apache2/apache2.conf:

# Include the AWStats configuration
Include /usr/local/awstats/tools/httpd_conf

Reload the Apache configuration:

sudo /etc/init.d/apache2 reload

Create a configuration file for your site:

sudo cp /usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf \

Edit the newly created configuration file and change the following lines to suit your needs:


Generate the first statistics:

sudo -u www-data /usr/bin/perl /usr/local/awstats/wwwroot/cgi-bin/ \

If the sudo command above doesn't work for your user, then use sudo su - to gain root privileges, and run it again as root.

Now add a cron entry in /etc/crontab to periodically update the statistics:

*/10 * * * * www-data /usr/bin/perl /usr/local/awstats/wwwroot/cgi-bin/ -update >/dev/null

To access AWStats now, go to /awstats/ in your browser.