How to Install AWStats on Debian Latest
AWStats is a free and powerful tool that generates advanced web server stats, including the number of visitors, pages viewed, keywords used, and more. In this tutorial, we will guide you through the process of installing AWStats on Debian.
Prerequisites
- A Debian server that is up to date.
- Root access to your server.
Step 1: Install Required Packages
The first step is to install the necessary dependencies for AWStats to run. To do this, enter the following command:
sudo apt-get update
sudo apt-get install awstats libgeo-ipfree-perl
Step 2: Configure AWStats
Once the required packages have been installed, you need to configure AWStats to work with your website.
First, create a configuration file for your website:
sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.example.com.conf
Next, edit this configuration file by changing the SiteDomain and LogFile directives:
sudo nano /etc/awstats/awstats.example.com.conf
Change the SiteDomain value to your website's domain name, and the LogFile value to your web server's Apache access log file:
SiteDomain="example.com"
LogFile="/var/log/apache2/access.log"
Save the file and exit the editor.
Step 3: Generate AWStats Report
After you've completed the configuration, AWStats can be executed to create the report.
Generate a report for your website by running the following command:
sudo /usr/lib/cgi-bin/awstats.pl -config=example.com -update
This command will generate the report and store it in the awstats directory at /var/lib/awstats/.
Step 4: Access AWStats Report in Web Browser
To access AWStats report in your web browser, you need to create a virtual host for AWStats.
Create a new configuration file for the Apache virtual host:
sudo nano /etc/apache2/sites-available/awstats.conf
Add the following content to the file:
<VirtualHost *:80>
ServerName awstats.example.com
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
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
AddHandler cgi-script .pl
</Directory>
</VirtualHost>
Save the file and exit the editor.
Enable the new virtual host by running the following command:
sudo a2ensite awstats.conf
Restart Apache to apply the changes:
sudo systemctl restart apache2
Now you can access the AWStats report by navigating to http://awstats.example.com/awstats/awstats.pl?config=example.com in your web browser.
Conclusion
By following the steps outlined in this tutorial, you should be able to install AWStats on Debian, create a report, and access the report in your web browser. AWStats is an incredibly valuable tool for monitoring website traffic and optimizing your online presence.