Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Setup AWStats (Apache Log Analyzer) on CentOS, RHEL and Fedora

    How to Setup AWStats (Apache Log Analyzer) on CentOS, RHEL and Fedora

    By RahulFebruary 28, 20143 Mins Read

    AWStats is a free and very powerful tool that creating statics by analyzing Apache log files, ftp or mail servers. AWStats log analyzer works on CGI or command line interface and generate graphical statics from log files.

    Advertisement

    This how to guide will help you to install and configure AWStats Apache Log Analyzer on CentOS, RHEL and Fedora systems. This article has been tested with CentOS 7.2 only.

    Step 1 – Setup EPEL Repository

    Firstly install EPEL repository on your system using below command.

    # yum install epel-release
    

    Step 2 – Install Apache Server

    AWStats required Apache web server to be running. If you don’t have Apache install Use below commands else you already have httpd installed skip this step.

    # yum install httpd
    # chkconfig httpd on
    # service httpd start
    

    Step 3: Install AWStats

    After installing web server, Let’s install AWStats package using yum. Its will also install all other required dependencies.

    # yum install awstats
    

    Step 4 – Configure Apache for AWStats

    By default AWStats creates an Apache configuration file /etc/httpd/conf.d/awstats.conf. Default configuration is ok to use except allow from access. If you need to access awstats from network, update the allow from ip with your system or network ip from where we need to access it.

    # vim /etc/httpd/conf.d/awstats.conf
    
    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/"
    
    <Directory "/usr/share/awstats/wwwroot">
        Options None
        AllowOverride None
        <IfModule mod_authz_core.c>
            # Apache 2.4
            Require host 192.168.0.0/24
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order allow,deny
            Allow from 192.168.0.0/24
            Allow from ::1
        </IfModule>
    </Directory>
    
    <IfModule mod_env.c>
        SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
    </IfModule>
    

    Restart Apache service to reload new settings

    # service httpd restart
    

    Step 5 – Create AWStats Configuration File

    Its required to create an configuration file for each of your website for which statics need to generate. Copy AWStats example configuration file with new name and make changes as below.

    # cp /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats.tecadmin.net.conf
    # vim /etc/awstats/awstats.tecadmin.net.conf
    

    Update below settings in awstats.tecadmin.net.conf file

    LogFile="/var/log/httpd/tecadmin.net-access_log"
    SiteDomain="tecadmin.net"
    HostAliases="tecadmin.net www.tecadmin.net"
    

    Now execute following command to update logs files

    # perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=tecadmin.net -update
    

    Step 6 – Schedule Cron to Update Logs

    Schedule a cron job to regularly update AWStats database using newly created log entries. Add new cron job in crontab like below. Read examples of cron scheduling

     0 2 * * * /usr/bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=tecadmin.net -update
    

    Step 7 – Access AWStats in Browser

    Use your server ip address or domain name to access AWStats statics. Change domain name at the end of url as per your settings.

    https://tecadmin.net/awstats/awstats.pl?config=tecadmin.net
    

    awstats-log

    Congratulation’s! you have successfully configured AWStats for you website. Read our next article to Setup vnStat ( Web based Network Monitoring Tool ) and Install Munin Network Monitoring Tool on your Linux system.

    Apache Log Analyzer awstats awstats installation setup awstats
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    An Introduction to the “./configure” Command: Compiling Source Code in Linux

    Getting Started with Linux Command line: The Beginning

    Backing Up Your Linux System with Rsync: A Step-by-Step Guide

    View 15 Comments

    15 Comments

    1. SDB on April 25, 2019 11:26 am

      I am getting below error while trying to access awstats url from browser.
      Invalid file path. Please check the correct URL.
      Please help.

      Reply
    2. Ross on March 7, 2018 11:18 am

      Also Please update about
      How to enable username and password for access the awstat report

      Thanks

      Reply
      • Kiosk on March 10, 2018 7:00 am

        Hi ,

        The same Question i also have . Very simple and good article .BUt importantly we have to secure .Please share how to setup user name and password for Awstat

        Thanks

        Reply
    3. ThomasCync on April 18, 2016 1:07 pm

      Howdy, nice web site you’ve in here.

      Reply
    4. Pankaj on August 12, 2015 10:06 am

      Hi,

      Please could you guide, How to configure Awstats with Nginx.

      I have configure all with Niginx, but unable to view it on browser, Am sure there would be a perl base configuration required for same.

      Please advice.

      Reply
    5. Hunky on June 10, 2015 8:40 am

      How to do this same thing on a server which is running multiple domain under one shared IP address ??

      How to configure AwStats for each domain ??

      Would be great if you please update the tutorial for the same..

      Reply
    6. Shankar Patel on June 4, 2015 5:43 pm

      Good article. Saved my time.

      Reply
    7. chris on June 19, 2014 6:06 am

      Awesome Blog. I followed the steps, it is working on my site now,thanks

      Reply
    8. djitri2000 on April 24, 2014 5:46 pm

      Hi.
      the bellow command bug whith centos 6.5

      crontab -l 0 2 * * * /usr/bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=tecadmin.net -update

      crontab : option invalide — ‘c’
      crontab: usage error: unrecognized option

      Reply
    9. Malissa on October 6, 2013 5:20 pm

      Very good info. Lucky me I discovered your website by accident (stumbleupon).
      I’ve bookmarked it for later!

      Reply
    10. carter cole on July 1, 2013 5:16 pm

      your stupid plugin that spams the clipboard on copy is snipping the text so i cant copy and paste the config file… very annoying at least let the whole thing get copied

      Reply
      • xnxx on May 2, 2015 1:30 pm

        Try using nano instead of vim when i was a noob it kinda pissed me off too..

        Great guide btw rahul 🙂

        Reply
    11. www.satellitecardsharing.com/dreamsharing/ on April 28, 2013 5:14 am

      Hey very interesting blog!

      Reply
    12. longchamp outlet on April 24, 2013 4:51 am

      Awesome Blog. I add this Post to my bookmarks.

      Reply
    13. Daniel on April 16, 2013 3:12 pm

      nice article, very well written….

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Split Large Archives in Linux using the Command Line
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.