How to install AWStats on Ubuntu Server Latest
Introduction
AWStats is a powerful log file analyzer that generates advanced web, streaming, FTP or mail server statistics graphically. It can display static web pages or generate dynamic pages with Javascript, and has per-user or per-IP address reports. The installation process in Ubuntu Server Latest is straightforward, and this tutorial will guide you through the steps.
Prerequisites
- You need to have a server running Ubuntu Server Latest
- You must have root privileges or be able to use
sudo
Step 1: Install AWStats
- Open the terminal on your Ubuntu Server, and update your package list by running the following command:
sudo apt-get update
- Install AWStats by running:
sudo apt-get install awstats
During the installation process, you will be prompted to set up your mail server. The default option should work, so you can press Enter.
Once the installation is complete, you need to configure AWStats to analyze the log files of the web server you want to monitor. In this example, we will configure it to analyze the Apache web server log files.
Open the configuration file for Apache's log files using your favorite text editor. In this example, we'll use
nano:
sudo nano /etc/apache2/conf-available/other-vhosts-access-log.conf
- Scroll down to the line that reads
CustomLogand add the following two lines immediately above it:
# AWStats configuration
Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
ScriptAlias /awstats/ "/usr/lib/cgi-bin/"
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Save and exit the file by pressing
Ctrl+X, thenYfor yes andEnterto confirm.Restart the Apache web server to make the changes take effect:
sudo systemctl restart apache2
Step 2: Configure AWStats
- Open the configuration file for AWStats by running:
sudo nano /etc/awstats/awstats.conf
- Scroll down to the
SiteDomainoption and enter the domain name of the website you want to monitor:
SiteDomain="example.com"
Replace example.com with the actual domain name of your website.
- Scroll down to the
LogFileoption and enter the path to the Apache log file:
LogFile="/var/log/apache2/access.log"
Replace /var/log/apache2/access.log with the path to the Apache log file on your server.
Save and exit the file by pressing
Ctrl+X, thenYfor yes andEnterto confirm.Generate the initial statistics for your website by running:
sudo /usr/lib/cgi-bin/awstats.pl -config=example.com -update
Replace example.com with the name of the configuration file you just edited.
Step 3: Access AWStats
- Open a web browser on your local machine and navigate to
http://your-server-ip/awstats/awstats.pl?config=example.com.
Replace your-server-ip with the IP address or domain name of your server, and example.com with the name of the configuration file you just edited.
- You should now see the AWStats web interface. Explore the different features to view your website's statistics.
Conclusion
You have successfully installed and configured AWStats on your Ubuntu Server Latest. You can now use it to generate advanced statistics for your website.