Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Install AWStats (Apache Log Analyzer) on Ubuntu, Debian & Linux Mint

    How to Install AWStats (Apache Log Analyzer) on Ubuntu, Debian & Linux Mint

    By RahulFebruary 7, 20233 Mins Read

    AWStats is a powerful, open-source log analyzer tool that helps website owners and administrators understand the traffic on their websites. It provides detailed information about the visitors to the website, including the number of visitors, their geographical location, the pages they visited, and more. With this information, website owners can optimize their websites and improve their online presence.

    Advertisement

    In this article, we will show you how to install AWStats on Ubuntu, Debian, and Linux Mint, three popular Linux distributions. This article has been tested with Ubuntu 22.04 LTS.

    Prerequisites

    Before we start the installation, make sure that you have the Apache web server installed on your system. If not, you can install it by running the following command:

    sudo apt-get update 
    sudo apt-get install apache2 
    

    Step 1: Installing AWStats

    AWStats required an Apache web server. If you don’t have Apache installed Use the below commands to install the Apache2 web server and AWStats packages. It will also install all other required dependencies.

    sudo apt install awstats 
    

    Step 2: Configure Apache

    Now create an Apache configuration file for AWStats setup. Use your favorite text editor and edit a new file /etc/apache2/conf-available/awstats.conf.

    sudo nano /etc/apache2/conf-available/awstats.conf 
    

    Now add the following configuration

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    ScriptAlias /awstats/ /usr/lib/cgi-bin/
    Alias /awstats-icon/ /usr/share/awstats/icon/
    Alias /awstatsclasses/ /usr/share/java/awstats/
     
    <Directory "/usr/lib/cgi-bin/">
        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>

    Make sure to update Require host and Allow from IP range as per the Apache version.

    Now enable the CGI module (if not enabled) and Also enable Awstats apache configuration.

    sudo a2enmod cgi 
    sudo a2enconf awstats 
    

    Restart the Apache service to reload new settings

    sudo systemctl restart apache2 
    

    Step 3: Create AWStats Configuration File

    It’s required to create a configuration file for each of your websites for which statics need to generate. Copy the AWStats example configuration file with a new name and make changes as below.

    sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.example.com.conf 
    sudo nano /etc/awstats/awstats.example.com.conf 
    

    Replace “example.com” in the above command with the name of your domain.

    Now, update the following configuration settings in awstats.example.com.conf:

    • Set the log file path:
      1
      LogFile="/var/log/apache2/example.com-access_log"
    • Set the domain name:
      1
      SiteDomain="tecadmin.net"
    • Set the aliases for the host:
      1
      HostAliases="example.com www.example.com"

    Now execute the following command to update log files. The AWStats automatically detects already processed logs and ignore them. It will only process the new logs.

    sudo /usr/lib/cgi-bin/awstats.pl -config=example.com -update 
    

    Replace “example.com” in the above command with the name of your domain.

    Step 4: Access AWStats

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

    https://example.com/awstats/awstats.pl?config=tecadmin.net
    
    How to Install AWStats on Linux
    Awstats

    Conclusion

    In conclusion, AWStats is a valuable tool for website owners and administrators who want to understand the traffic on their websites. With its detailed statistics, website owners can make informed decisions about how to improve their website and reach their target audience. Installing AWStats on Ubuntu, Debian, and Linux Mint is a straightforward process that can be completed in a few simple steps. With this guide, you can easily install AWStats and start analyzing your website traffic to make informed decisions about how to improve your website. Whether you’re a beginner or an experienced user, this guide will help you get started with AWStats and make the most of its features.

    Apache Log Analyzer awstats Install AWStats Log Analyzer
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    What are the difference between SH and BASH

    What are the difference between SH and BASH?

    Understanding the Zombie Processes in Linux

    A Comprehensive Guide to Shutting Down or Rebooting Linux System

    View 6 Comments

    6 Comments

    1. toto on October 8, 2021 12:58 pm

      I get this error message at step 4 : Error: SiteDomain parameter not defined in your config/domain file. You must edit it for using this version of AWStats.
      Setup (‘/etc/awstats/awstats.conf’ file, web server or permissions) may be wrong.
      Check config file, permissions and AWStats documentation (in ‘docs’ directory).

      Reply
    2. toto on October 8, 2021 12:57 pm

      with ubuntu 20.04, I get this error message

      Reply
    3. bbpets2 on August 27, 2021 7:36 am

      hey,

      could you run this command again in 2021.I bet those visitors numbers are off the roof

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

      lol

      Reply
    4. Hameed Hussain on July 19, 2020 10:27 am

      Hi, It is showing the dashboard but no data. Can you please hep me to resolve. Thank you

      Reply
    5. labrat on May 22, 2018 12:19 am

      The Apache allow commands did not secure access to awstats.

      The /etc/awstats.—-.conf file has the parameter:
      AllowAccessFromWebToFollowingIPAddresses=””

      which worked nicely for me.

      Reply
    6. Calx on May 5, 2017 12:04 am

      Congratulations and thanks Rahul.I tryed before several long tutorial probably too old to install awstats and only your work with Debian Jessy.Just at the end have to change owner of /var/lib/awstats.It is by default awstats and it require to be www-data.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • The Difference Between Git Reset –soft, –mixed, and –hard
    • Understanding the Staging Area in Git’s Workflow
    • Python Function with Parameters, Return and Data Types
    • free Command in Linux (Check Memory Uses)
    • Git Rebase: A Practical Guide
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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