Installing Awstats on your VPS

Install AWSTAT

wget http://downloads.sourceforge.net/awstats/awstats-6.8-1.noarch.rpm?modtime=1216600880&big_mirror=0
rpm -ivh awstats-6.8-1.noarch.rpm


wget http://downloads.sourceforge.net/awstats/awstats-6.8.tar.gz?modtime=1216600948&big_mirror=0
tar zxvf awstats-6.8.tar.gz
cd awstats-6.8

AWStats gets installed in the /usr/local/awstats

     AWStats 6.8 - Laurent Destailleur

AWStats files have been installed in /usr/local/awstats

If first install, follow instructions in documentation
(/usr/local/awstats/docs/index.html) to setup AWStats in 3 steps:
Step 1 : Install and Setup with awstats_configure.pl (or manually)
Step 2 : Build/Update Statistics with awstats.pl
Step 3 : Read Statistics


and we now need to run awstats_configure.pl from within the /usr/local/awstats/tools

cd /usr/local/awstats/tools

perl awstats_configure.pl

Enter full config file path of your Web server
Config file path ('none' to skip web server setup):
> /etc/httpd/conf/httpd.conf
-----> Need to create a new config file ?
Do you want me to build a  new AWStats config/profile
file (required if first install) [y/N] ?y
-----> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):

Enter the name of your domain when prompted for it.

——-> Create config file ’/etc/awstats/awstats.rptest.railsplayground.net.conf’
Config file /etc/awstats/awstats.rptest.railsplayground.net.conf created.

-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=rptest.railsplayground.net
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...

A SIMPLE config file has been created: /etc/awstats/awstats.rptest.railsplayground.net.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'rptest.railsplayground.net' with command:

> perl awstats.pl -update -config=rptest.railsplayground.net
You can also read your statistics for 'rptest.railsplayground.net' with URL:

> http://localhost/awstats/awstats.pl?config=rptest.railsplayground.net

You will need to now create cronjob that schedules to run the awstats_updateall.pl to update all the Stats running on your VPS.

crontab -e

* * * * 7 /usr/bin/perl /usr/local/awstats/tools/awstats_updateall.pl now

The AWStats Perl script has a .pl extension. By default on CentOS, only .cgi scripts are interpreted as CGI Scripts, so you’ll need to add the .pl extension as a cgi-script. This can be done either gobally in the /etc/httpd/conf/httpd.conf file, or just for this AWStats installation.

To make the change globally, open up the /etc/httpd/conf/httpd.conf file in your favourite text editor, either as root or using sudo, and change

#AddHandler cgi-script .cgi


AddHandler cgi-script .cgi

You’ll also need to add “Options ExecCGI” to the directory that the AWStats Perl files are located. This can be done eiether in a virtualhost file or in the main httpd.conf file like so:

<Directory /usr/local/awstats/wwwroot/cgi-bin>
    Options ExecCGI

If you decided to only have .pl enabled as a cgi-script for AWStats, then the above directory block should look like this instead

<Directory /usr/local/awstats/wwwroot/cgi-bin>
    Options ExecCGI
    AddHandler cgi-script .pl

Now restart the Apache server on your VPS.