UbuntuUbuntu Based

How To Install AWStats on Ubuntu 22.04 LTS

Install AWStats on Ubuntu 22.04

In this tutorial, we will show you how to install AWStats on Ubuntu 22.04 LTS. AWStats is a powerful open-source log analyzer that provides website owners and administrators with valuable insights into their website traffic. By leveraging AWStats, you can track key metrics like the number of visitors, geographical location of visitors, most popular pages, entry and exit pages, and more.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the AWStats real-time logfile analyzer on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for AWStats.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install AWStats on Ubuntu 22.04 LTS Jammy Jellyfish

Step 1. Before diving into the installation of AWStats, it’s essential to ensure that the Apache web server is already installed on your system. Apache serves as the foundation for AWStats, making it a necessary prerequisite. If Apache is not already installed, you can do so by running the following commands:

sudo apt update
sudo apt install apache2

Step 2. Installing AWStats on Ubuntu 22.04.

With Apache installed, you’re ready to install AWStats. This process is straightforward, thanks to Ubuntu’s package manager. Run the following command to install AWStats:

sudo apt install awstats

This command will install AWStats and all its required dependencies, preparing your system for the next steps.

Step 3. Configuring Apache for AWStats.

For Apache to communicate properly with AWStats, a configuration file needs to be created. Now open a new file /etc/apache2/conf-available/awstats.conf:

<Location /awstats>
Require host localhost
Allow from 127.0.0.1 ::1
</Location>

Save and close the file when finished.

Step 4. Set up AWStats Configuration.

Each website domain needs its own AWStats configuration file. Navigate to /etc/awstats and make a copy of awstats.conf for each domain:

cd /etc/awstats
sudo cp awstats.conf awstats.yourdomain.com.conf

Open the new config file and update the following parameters:

LogFile="/var/log/apache2/access.log" 
SiteDomain="yourdomain.com"
HostAliases="www.yourdomain.com yourdomain.com" 

Repeat this process for any additional domains.

To populate AWStats with initial data, run:

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

This will analyze the Apache logs and generate stats based on historical data.

Step 5. Enable AWStats in Apache.

The final step is enabling AWStats within Apache:

sudo a2enmod cgi

Then update your Apache site configuration at /etc/apache2/sites-available/000-default.conf to allow CGI execution:

<Directory "/usr/lib/cgi-bin">
   AllowOverride None
   Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
   Require all granted
</Directory>

Restart Apache for changes to take effect:

sudo systemctl restart apache2

Step 6. Accessing AWStats Web UI.

You can now access AWStats from http://yourdomain.com/awstats. The default credentials are:

  • Username: admin
  • Password: admin

The first load may take a while as AWStats processes all historical data. Subsequent loads will be much faster.

Install AWStats on Ubuntu 22.04 LTS Jammy Jellyfish

Congratulations! You have successfully installed AWStats. Thanks for using this tutorial for installing the AWStats logfile analyzer on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official AWStats website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button