How to Install and Configure Apache log analizer, AWstats on Fedora 16

In this guide, we will walk you through the process of installing and configuring AWStats, a powerful Apache log analyzer, on a Fedora 16 Linux server. AWStats is an open-source and feature-rich web analytics reporting tool and server logfile analyzer. It is suitable for analyzing data from various Internet services such as web, streaming media, mail, and FTP servers. It provides you with detailed statistics including visits, unique visitors, pages, hits, rush hours, operating systems, browsers, search engines, keywords, robots visits, broken links, and more.

AWStats is known for its ability to analyze Apache log files, mail log files, and FTP log files. It can generate static or dynamic HTML reports and can process split log files for clusters. It is recognized for its high speed and ability to handle large log formats. Moreover, its functionality can be extended with plugins.

Whether you’re using a dedicated server, a VPS server, or even cloud hosting or shared hosting, AWStats can provide you with valuable insights into your server’s performance and traffic.

Now, let’s proceed with the installation and configuration of AWStats on a Fedora 16 Linux server.

Installing AWStats

To install AWStats, you need to run the following command:

[root@fedora16 ~]# yum install awstats -y

This command will start the installation process. It will resolve dependencies, run a transaction check, and install the necessary packages. The installation process involves downloading packages, running transaction checks and tests, and finally installing the packages.

Example:

[root@fedora16 ~]# yum install awstats -y
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package awstats.noarch 0:7.0-6.fc16 will be installed
--> Processing Dependency: perl(Switch) for package: awstats-7.0-6.fc16.noarch
--> Processing Dependency: perl(LWP::UserAgent) for package: awstats-7.0-6.fc16.noarch
--> Running transaction check
---> Package perl-Switch.noarch 0:2.16-1.fc16 will be installed
---> Package perl-libwww-perl.noarch 0:6.02-3.fc16 will be installed
--> Processing Dependency: perl(HTTP::Cookies) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Processing Dependency: perl(File::Listing) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Processing Dependency: perl(HTTP::Daemon) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Processing Dependency: perl(WWW::RobotRules) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Processing Dependency: perl(HTTP::Negotiate) >= 6 for package: perl-libwww-perl-6.02-3.fc16.noarch
--> Running transaction check
---> Package perl-File-Listing.noarch 0:6.02-3.fc16 will be installed
---> Package perl-HTTP-Cookies.noarch 0:6.00-3.fc16 will be installed
---> Package perl-HTTP-Daemon.noarch 0:6.00-3.fc16 will be installed
---> Package perl-HTTP-Negotiate.noarch 0:6.00-3.fc16 will be installed
---> Package perl-WWW-RobotRules.noarch 0:6.01-3.fc16 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                     Arch           Version               Repository                   Size
====================================================================================================
Installing:
 awstats                     noarch         7.0-6.fc16            updates                     1.1 M
Installing for dependencies:
 perl-File-Listing           noarch         6.02-3.fc16           Fedora16-Repository          11 k
 perl-HTTP-Cookies           noarch         6.00-3.fc16           Fedora16-Repository          25 k
 perl-HTTP-Daemon            noarch         6.00-3.fc16           Fedora16-Repository          19 k
 perl-HTTP-Negotiate         noarch         6.00-3.fc16           Fedora16-Repository          16 k
 perl-Switch                 noarch         2.16-1.fc16           fedora                       21 k
 perl-WWW-RobotRules         noarch         6.01-3.fc16           Fedora16-Repository          17 k
 perl-libwww-perl            noarch         6.02-3.fc16           Fedora16-Repository         199 k

Transaction Summary
====================================================================================================
Install       8 Packages

Total download size: 1.4 M
Installed size: 4.1 M
Downloading Packages:
(1/8): awstats-7.0-6.fc16.noarch.rpm                                         | 1.1 MB     00:32
(6/8): perl-Switch-2.16-1.fc16.noarch.rpm                                    |  21 kB     00:00
----------------------------------------------------------------------------------------------------
Total                                                                38 kB/s | 1.4 MB     00:39
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : perl-HTTP-Negotiate-6.00-3.fc16.noarch                                           1/8
  Installing : perl-HTTP-Daemon-6.00-3.fc16.noarch                                              2/8
  Installing : perl-HTTP-Cookies-6.00-3.fc16.noarch                                             3/8
  Installing : perl-File-Listing-6.02-3.fc16.noarch                                             4/8
  Installing : perl-WWW-RobotRules-6.01-3.fc16.noarch                                           5/8
  Installing : perl-libwww-perl-6.02-3.fc16.noarch                                              6/8
  Installing : perl-Switch-2.16-1.fc16.noarch                                                   7/8
  Installing : awstats-7.0-6.fc16.noarch                                                        8/8

Installed:
  awstats.noarch 0:7.0-6.fc16

Dependency Installed:
  perl-File-Listing.noarch 0:6.02-3.fc16          perl-HTTP-Cookies.noarch 0:6.00-3.fc16
  perl-HTTP-Daemon.noarch 0:6.00-3.fc16           perl-HTTP-Negotiate.noarch 0:6.00-3.fc16
  perl-Switch.noarch 0:2.16-1.fc16                perl-WWW-RobotRules.noarch 0:6.01-3.fc16
  perl-libwww-perl.noarch 0:6.02-3.fc16

Complete!

Configuring AWStats

Once AWStats is installed, you need to configure it. This involves modifying the AWStats virtual host configuration file for your local server, in this case, fedora16.webhostinggeeks.local.

[root@fedora16 ~]# vi /etc/awstats/awstats.fedora16.webhostinggeeks.local.conf

In this file, you need to modify the line 122 for the log format in httpd.conf to ‘combined’ and set it to ‘1’. Also, modify line 168 to set the IP address to exclude.

LogFormat=1
HostAliases="localhost 127.0.0.1 REGEX[fedora16\\.webhostinggeeks\\.local$] REGEX[^192\\.168\\.1\\.]"

Next, you need to modify the main AWStats configuration file, awstats.conf.

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

In this file, add the following aliases and allow access from your IP range:

Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/share/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/"
Alias /report "/usr/share/awstats/wwwroot/"

Options None
AllowOverride None
Order allow,deny
Allow from 127.0.0.1 192.168.1.0/24

SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins

After making these changes, restart the Apache httpd service:

[root@fedora16 ~]# systemctl restart httpd.service

Generating Reports

With AWStats installed and configured, you can now generate reports. To do this, run the following command:

[root@fedora16 ~]# /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=fedora16.webhostinggeeks.local -update

This command will create or update the database for AWStats using the data in the log file. It will bypass old records and search for new records from the beginning of the log file.

See also  How to Stop and Remove Sendmail on Fedora 16

Output:

Create/Update database for config "/etc/awstats/awstats.fedora16.webhostinggeeks.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.

Next, generate HTML from the reports:

[root@fedora16 ~]# /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=fedora16.webhostinggeeks.local -output -staticlink > /usr/share/awstats/wwwroot/index.html

Setting Up Cron

Finally, you need to change the cron’s setting to ensure that AWStats updates regularly. To do this, open the cron file:

[root@fedora16 ~]# vi /etc/cron.hourly/awstats

In this file, uncomment and add the following lines:

#!/bin/bash
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=fedora16.webhostinggeeks.local -update > /dev/null
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=fedora16.webhostinggeeks.local -output -staticlink > /usr/share/awstats/wwwroot/index.html
exit 0

This new cron setting will update AWStats and generate a new HTML report every hour.

See also  How to Configure Nginx as a HTTP Cache

With these steps, you have successfully installed and configured AWStats on a Fedora 16 Linux server. Now, you can use AWStats to analyze your server logs and gain valuable insights into your server’s performance and traffic.

Commands Mentioned

  • yum install awstats -y – This command installs AWStats on your server.
  • vi /etc/awstats/awstats.fedora16.webhostinggeeks.local.conf – This command opens the AWStats virtual host configuration file for editing.
  • vi /etc/httpd/conf.d/awstats.conf – This command opens the main AWStats configuration file for editing.
  • systemctl restart httpd.service – This command restarts the Apache httpd service.
  • /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=fedora16.webhostinggeeks.local -update – This command creates or updates the AWStats database.
  • /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=fedora16.webhostinggeeks.local -output -staticlink > /usr/share/awstats/wwwroot/index.html – This command generates HTML from the AWStats reports.
  • vi /etc/cron.hourly/awstats – This command opens the cron file for editing.

Conclusion

AWStats is a powerful tool that provides valuable insights into your server’s performance and traffic. By installing and configuring AWStats on your Fedora 16 Linux server, you can analyze your server logs and make informed decisions to improve your server’s performance.

See also  How to Fix "Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again" Error When using Local DVD-ROM/CD-ROM Yum Repository on Fedora 16

Remember, AWStats is not just for Apache servers. It can analyze data from various Internet services such as web, streaming media, mail, and FTP servers. So, whether you’re using Apache, Nginx, LiteSpeed, or any other server, you can use AWStats to gain a deeper understanding of your server’s performance and traffic.

We hope this guide has been helpful in explaining how to install and configure AWStats on a Fedora 16 Linux server. If you have any questions or need further assistance, feel free to ask. Happy analyzing!

FAQs

  1. What is AWStats?

    AWStats is an open-source and feature-rich web analytics reporting tool and server logfile analyzer. It is suitable for analyzing data from various Internet services such as web, streaming media, mail, and FTP servers.

  2. How do I install AWStats on a Fedora 16 Linux server?

    You can install AWStats on a Fedora 16 Linux server by running the command ‘yum install awstats -y’. This will start the installation process, resolve dependencies, run a transaction check, and install the necessary packages.

  3. How do I configure AWStats?

    You can configure AWStats by modifying the AWStats virtual host configuration file and the main AWStats configuration file. After making the necessary changes, restart the Apache httpd service.

  4. How do I generate reports with AWStats?

    You can generate reports with AWStats by running the command ‘/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=fedora16.webhostinggeeks.local -update’. This will create or update the AWStats database. Then, generate HTML from the reports by running the command ‘/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=fedora16.webhostinggeeks.local -output -staticlink > /usr/share/awstats/wwwroot/index.html’.

  5. How do I set up cron for AWStats?

    You can set up cron for AWStats by opening the cron file for editing and uncommenting and adding the necessary lines. The new cron setting will update AWStats and generate a new HTML report every hour.

Comments

Leave a Reply

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