Install Awstats on Ubuntu

Tested with Ubuntu server 8.04 (Hardy Heron).


sudo aptitude install awstats

To see the country of your visitors (not required)

sudo aptitude install libnet-ip-perl
sudo aptitude install libgeo-ipfree-perl


Let's assume you want to analyze the Apache 2 log file of your website “” (It can be just an IP address).

Create configuration file

sudo cp /etc/awstats/awstats.conf /etc/awstats/

Update these parameters

# apache2

# domain name


You can also activate these plugins



sudo /usr/lib/cgi-bin/ -update

You should get something like this

Create/Update database for config "/etc/awstats/" by AWStats version 6.7 (build 1.892)
From data in log file "/var/log/apache2/access.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 191338
 Found 0 dropped records,
 Found 24 corrupted records,
 Found 0 old records,
 Found 191314 new qualified records.

Configure Apache to view the statistics

Create /etc/apache2/conf.d/statistics

Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon/ "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /statistics/ /usr/lib/cgi-bin/
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch

Restart Apache

sudo /etc/init.d/apache2 restart

View your statistics

or (in case you have more than one config file)

Update your statistics with cron

In /etc/crontab add

# update every 10 min
*/10 * * * * root /usr/lib/cgi-bin/ -update > /dev/null

How to reset awstats

Just delete the files in /var/lib/awtstats (directory defined by DirData parameter)

sudo su - root
cd /var/lib/awstats
rm *


  • you have to be root because for some reason, sudo rm -R awstats/* wouldn't work.
  • if you get the message Never updated (See 'Build/Update' on awstats_setup.html page) whereas the awstats files are there in /var/lib/awtstats, it's probably a permission problem on this folder.



awstats "Error: SiteDomain parameter not defined in your config/domain file. You must edit it for using this version of AWStats. "

Try to this URL (with your values):




thank you this is very good tutorial
Psychic Zero
Oct 29, 2009
Installation explained in a truly simple manner.
Jan 18, 2010
Simple but excellent
Feb 8, 2010
Quick Question.. I just installed it, and i was wonderign if its possible to make the URL private.. I dont want the whole world to see my access reports..
Feb 18, 2010
Spot on. There are a lot of really over complex guides out there, this gets the job done flawlessly.

May 17, 2010
Thanks. Worked a treat.
Doc John
May 23, 2010
Thank you very much!
Jul 12, 2010
Jérôme, this was easily the most helpful, concise, and informative description on setting up AWStats that I have seen after scouring Google for a good amount of time.

Thanks for the post!
Matt Layman
Sep 11, 2010
nice job! That was so easy! Usingit with jawstats now. Looks really nice
Dec 11, 2010
Thanks! Nice tutorial
Apr 6, 2011
Hey, thanks for the tutorial: One error I found is that you don't need the "root" part at the beginning of the crontab command line. this produces an error. you just need to install the crontab for user root, so the correct line should be:

*/15 * * * * /usr/lib/cgi-bin/ -update > /dev/null

to run it every 15 min.
Fabian Koehler
May 30, 2011
Ok, sorry, this was my fault. Of couse you are editing /etc/crontab directly. so the "root" user in the beginning makes sense :)
Fabian Koehler
May 30, 2011
Hey, I like the large font. Even I can see it this way. It is a nice tutorial and easy to follow, unlike many others where you have to figure out what you actually just saw.
Norbert, KJ6ZD
May 31, 2011
Just awesome, thanks! I wish there were more tutorials available like this for Ubuntu.
Tom Purl
Jul 11, 2011
Thanks, really accurate article
Jul 28, 2011
Aug 23, 2011
Excellent tutorial, had awstats up and running within minutes.
Aug 29, 2011
Thanks a lot.

Is there a way, I can link it to a login
Sep 28, 2011
sudo -i

Don't like to write sudo all the time
Oct 26, 2011
Patrick Kelley
Feb 14, 2012
Thanks a lot. You helped me setting up AWStats.
May 29, 2012
Oii eu estalar um jogos
welton lima
Jan 11, 2013
nice totu tkx
Feb 4, 2013
I can confirm it still works on Ubuntu 12.10.

Warning! If you monitor a public server, then the statistics are public either: BIG security hazard!
Apr 25, 2013
thanks for these straightforward explications! works as is on ubuntu 13.04.
Aug 17, 2013
Thanks for this very clear tutorial !
Works like a charm on latest Debian.
Aug 18, 2013
muy bueno
Oct 18, 2013
Thank you so much!
Alex P.
Jan 11, 2014
Thanks for the information; was very helpful.
Aug 6, 2014
Thanks a lot! Very nice post.
Aug 28, 2014