How to Install Awstats on CentOS 5.5

In this guide, we will walk you through the process of installing AWStats on a CentOS server. AWStats is a robust, free tool that generates advanced website statistics in a graphical format. This tutorial is designed for those who have root access to a CentOS server with an Apache server installed and a domain, such as www.my.local, properly configured.

AWStats is a valuable tool for webmasters and website administrators as it provides detailed insights into website traffic, helping you understand your audience better.

Step 1: Download and Install the RPMForge Repository

The first step in the installation process is to download and install the RPMForge repository. This can be done using the following commands:

For 32-bit (x86) systems:

[root@server ~]# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

For 64-bit (x64) systems:

[root@server ~]# rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

Step 2: Install AWStats with Yum Command

Once the RPMForge repository has been installed, you can proceed to install AWStats using the yum command:

[root@server ~]# yum --enablerepo=rpmforge install awstats -y

This command will install AWStats and all its dependencies. The installation process may take a few minutes to complete.

Example:

[root@server ~]# yum --enablerepo=rpmforge install awstats -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: centos.maulvi.net
 * base: centos.maulvi.net
 * epel: ftp.cuhk.edu.hk
 * extras: centos.maulvi.net
 * rpmforge: fr2.rpmfind.net
 * updates: mirror.yourconnect.com
addons                                                        |  951 B     00:00
base                                                          | 1.1 kB     00:00
epel                                                          | 3.7 kB     00:00
extras                                                        | 2.1 kB     00:00
rpmforge                                                      | 1.1 kB     00:00
updates                                                       | 1.9 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package awstats.noarch 0:7.0-2.el5.rf set to be updated
--> Processing Dependency: perl(Geo::IP) for package: awstats
--> Running transaction check
---> Package perl-Geo-IP.i386 0:1.38-1.el5.rf set to be updated
--> Processing Dependency: libGeoIP.so.1 for package: perl-Geo-IP
--> Running transaction check
---> Package geoip.i386 0:1.4.6-1.el5.rf set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================
 Package             Arch           Version                   Repository        Size
=====================================================================================
Installing:
 awstats             noarch         7.0-2.el5.rf              rpmforge         1.2 M
Installing for dependencies:
 geoip               i386           1.4.6-1.el5.rf            rpmforge         782 k
 perl-Geo-IP         i386           1.38-1.el5.rf             rpmforge         118 k

Transaction Summary
=====================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 2.1 M
Downloading Packages:
(1/3): perl-Geo-IP-1.38-1.el5.rf.i386.rpm                     | 118 kB     00:01
(2/3): geoip-1.4.6-1.el5.rf.i386.rpm                          | 782 kB     00:13
(3/3): awstats-7.0-2.el5.rf.noarch.rpm                        | 1.2 MB     00:23
-------------------------------------------------------------------------------------
Total                                                 52 kB/s | 2.1 MB     00:41
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : geoip                                                         1/3
  Installing     : perl-Geo-IP                                                   2/3
  Installing     : awstats                                                       3/3

Installed:
  awstats.noarch 0:7.0-2.el5.rf

Dependency Installed:
  geoip.i386 0:1.4.6-1.el5.rf            perl-Geo-IP.i386 0:1.38-1.el5.rf

Complete!

Step 3: Modify AWStats Apache Configuration

After AWStats has been installed, you will need to modify the AWStats Apache configuration. This can be done using the vi editor:

[root@server ~]# vi /etc/httpd/conf.d/awstats.conf

In the configuration file, add the following lines:

Alias /awstats/icon/ /var/www/awstats/icon/
ScriptAlias /awstats/ /var/www/awstats/
<Directory /var/www/awstats/>
 DirectoryIndex awstats.pl
 Options ExecCGI
 order deny,allow
 allow from all
</Directory>

This configuration allows AWStats to run as a CGI script on your Apache server.

See also  How to Create System Configuration Summaries for CentOS 5.5 using cfg2html

Step 4: Rename Config File

Next, you will need to rename the default configuration file to match your domain. This can be done using the mv command:

[root@server ~]# mv /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats.www.my.local.conf

This command renames the default configuration file to awstats.www.my.local.conf.

Step 5: Modify “SiteDomain” and “HostAliases”

In the renamed configuration file, you will need to modify the “SiteDomain” and “HostAliases” lines to match your domain. This can be done using the vi editor:

SiteDomain="www.my.local"
HostAliases="localhost 127.0.0.1 REGEX[my\\.local$] REGEX[^10\\.0\\.0\\.]"

These settings tell AWStats which domain to update.

Step 6: Update Statistics

After modifying the configuration file, you need to update the statistics. This can be done using the awstats_updateall.pl script:

[root@server ~]# /usr/bin/awstats_updateall.pl now -confdir="/etc" -awstatsprog="/var/www/awstats/awstats.pl"
[root@server ~]# /usr/bin/awstats_updateall.pl now -confdir="/etc" -awstatsprog="/var/www/awstats/awstats.pl"
Running '"/var/www/awstats/awstats.pl" -update -config=www.my.local -configdir="/etc/awstats"' to update config www.my.local
Create/Update database for config "/etc/awstats/awstats.www.my.local.conf" by AWStats version 7.0 (build 1.971)
From data in log file "/var/log/httpd/access_log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 0
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 0 new qualified records.

This command updates the AWStats database with the latest statistics from your Apache log files.

See also  How to Prepare for Zimbra Collaboration Suite 8.0.2 Mail Server Installation on CentOS 6.4 x86_64

Step 7: Restart the Apache Service

Once the statistics have been updated, you need to restart the Apache service for the changes to take effect:

[root@server ~]# /etc/init.d/httpd start

This command starts the Apache service.

Step 8: Verify the Installation

Finally, you can verify the installation by accessing the AWStats interface through your web browser. Replace “CentOS_server” with your server’s IP address or domain name:

http://CentOS_server/awstats/awstats.pl?config=www.my.local

If the installation was successful, you should see the AWStats interface displaying statistics for your website.

Commands Mentioned

  • rpm -Uhv [URL] – Downloads and installs a package from the specified URL
  • yum –enablerepo=rpmforge install awstats -y – Installs AWStats from the RPMForge repository
  • vi /etc/httpd/conf.d/awstats.conf – Opens the AWStats Apache configuration file in the vi editor
  • mv [old file name] [new file name] – Renames a file
  • /usr/bin/awstats_updateall.pl now -confdir=”/etc” -awstatsprog=”/var/www/awstats/awstats.pl” – Updates AWStats statistics
  • /etc/init.d/httpd start – Starts the Apache service

Conclusion

In conclusion, installing AWStats on a CentOS server involves downloading and installing the RPMForge repository, installing AWStats using the yum command, modifying the AWStats Apache configuration, renaming the default configuration file, modifying the “SiteDomain” and “HostAliases” settings, updating the statistics, restarting the Apache service, and verifying the installation.

By following this guide, you should be able to successfully install AWStats on your CentOS server and start analyzing your website traffic. For more in-depth tutorials on Apache, Nginx, LiteSpeed, dedicated or virtual servers, feel free to explore our website.

See also  How to Reset CentOS root Password

Remember, understanding your website traffic is crucial for improving your web server performance and meeting your audience’s needs. Tools like AWStats can provide valuable insights that can help you make informed decisions about your website.

FAQs

  1. What is AWStats?

    AWStats is a free, open-source advanced web analytics tool that generates detailed website statistics. It is capable of analyzing log files from various servers, including Apache and Microsoft IIS.

  2. Why do I need to modify the AWStats Apache configuration?

    Modifying the AWStats Apache configuration allows AWStats to run as a CGI script on your Apache server. This enables you to access AWStats through your web browser.

  3. What does the “SiteDomain” setting in the AWStats configuration file do?

    The “SiteDomain” setting in the AWStats configuration file specifies the main URL or domain of your website. AWStats uses this setting to generate statistics specifically for this domain.

  4. What does the “HostAliases” setting in the AWStats configuration file do?

    The “HostAliases” setting in the AWStats configuration file lists all the possible aliases for your website, such as IP addresses, alternate domain names, and localhost. AWStats uses this setting to correctly attribute all log entries to your website, regardless of how it was accessed.

  5. How do I verify that AWStats has been installed correctly?

    You can verify the installation by accessing the AWStats interface through your web browser. If the installation was successful, you should see the AWStats interface displaying statistics for your website.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *