How to Install AWstats
Installing AWstats
"AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. This log analyzer works as a CGI or from command line and shows you all possible information your log contains, in few graphical web pages. It uses a partial information file to be able to process large log files, often and quickly. It can analyze log files from all major server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers."
AWstats Home
This tutorial shows how to install AWstats log file analyser on your VPS/Dedicated Server.
Two Installs Required!
The install of AWStats requires two installs, one for awstats and one for the webmin module.
Download a copy
Download a copy of AWstats in tar form, and a copy of the awstats webmin module. Downloads available at http://awstats.sourceforge.net/#DOWNLOAD
Upload AWstats to your server
login to your provided server control and upload AWstats to the /usr/local/ directory of your server.
Alternatively you can login through SSH and download AWstats directly to your server with the following code:
cd /usr/local
wget http://prdownloads.sourceforge.net/awstats/awstats-6.8.tar.gz
(url of download may change, this url was tested 10/11/2008)
Install AWstats
Login via SSH and enter the following code:
# Change to the Install Directory
cd /usr/local
# Extract the tar
tar -xvf awstats-6.8.tar.gz
# Move files (Rename folder)
mv awstats-6.8 awstats
# Change to configuration directory
cd awstats/tools/
# Run the install file
perl awstats_configure.pl
Follow "onscreen" instructions
- Where is your httpd.conf file? /etc/httpd/conf/httpd.conf
- Do You need a new config file? y
- What is your website name? www.yourdomain.com
- Where should I put config files? /etc/awstats
- ALL Done!
Install the Awstats Webmin module
- Login to Webmin
- Navigate to Webmin >> Webmin Configuration
- Select the "Webmin Modules" icon / link
- Upload the awstats webmin module from the file we downloaded earlier
- Select the "AWStats" link once Webmin has installed the new module
- Select the "Module Configuration" link
- Ensure the absolute path to awstats points to /usr/local/awstats/wwwroot/cgi-bin/awstats.pl
- Select the link "Save"
Add a cron job to auto update awstats
- Login to Webmin
- Navigate to System>> Scheduled Cron Jobs
- Select the link "Create a new scheduled cron job"
- Edit Setting: Execute cron job as root
- Edit Setting: Command to run /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.yourdomain.com
- Select the link "Save"
Create a Custom Log File
- Login to Webmin
- Navigate to Servers >> Apache Web Server
- Select the tab "Global Configuration"
- Select the link "Edit Config Files"
- Ensure "httpd.conf" is the selected config files to edit
- Ensure a log format suitable for Awstats exists LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
- Create a custom log file <VirtualHost www.yourdomain.com:80>
ServerName www.yourdomain.com
DocumentRoot /home/yourdomain.com/public_html
ErrorLog logs/yourdomain.com-error_log
CustomLog logs/yourdomain.com-access_log2 combined
</VirtualHost> Note: Custom Log Syntax: CustomLog file_location log_format - For Referance the install process created: #
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/local/awstats/wwwroot/">
DirectoryIndex awstats.pl
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory> - Select the link "Save"
Back to configure Awstats
- Login to Webmin
- Navigate to System >> Awstats
- If it reads awstats is not installed just run perl awstats_configure.pl through SSH again
Switch from the main log to your custom log
- Login to Webmin
- Navigate to System >> Awstats
- Select the link "Edit/Delete config"
- Edit Setting: LogFile /var/log/httpd/sakuiweb.com-access_log2
- Select the link "Save"
Enable DNS lookups, this enables a load of features
- Login to Webmin
- Navigate to System >> Awstats
- Select the link "Edit/Delete config"
- Edit Setting: DNSLookup 1(This setting suits the custom log format we defined in the httpd.conf)
- Select the link "Save"
Where to find your stats
With the above configuration you will find your reports at http://www.yourdomain.com/awstats/awstats.pl
Comment
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sakuiwe1/public_html/articles/how_to_install_awstats/index.php on line 191
