Peter's Blog

Redefining the Impossible

Awstats under Ubuntu


I never did get around to trying to install awstats. I've been using Statcounter but I fancied trying awstats with reverse DNS turned on. I can't do this on my Site5 host as they don't like reverse DNS. I didn't install it on Gentoo as that looked like big time hastle.

I realised today that installing awstats under Ubuntu should be as simple as installing the awstats package and it almost is. I can install it on my home server, download my Site5 access logs there and let awstats format them up.

Here are the steps I had to take to install it:

  • Install awstats package
  • Edit a file called /etc/awstats/awstats.hostname.conf where hostname is the hostname. Put something like this in it:
    LogFile="/var/log/apache/access.log"
    LogFormat=1
    DNSLookup=1
    DirData="/var/cache/awstats/"
    DirCgi="/cgi-bin"
    DirIcons="/icon"
    SiteDomain="hostname"
    AllowToUpdateStatsFromBrowser=1
    AllowFullYearView=3
    
  • Make a directory called /var/cache and chmod it 777 so it can be used from the web server
  • Copy icons to web directory:
    cp -r /usr/share/awstats/icon /var/www/icon
    
  • Run this to update databases:
    /usr/lib/cgi-bin/awstats.pl -config=hostname -update
    
  • In your web browser, go to the url:
    http://hostname/cgi-bin/awstats.pl?config=hostname
    
  • Study the stats in quiet awe
  • Edit crontab to update stats automatically every night:
    crontab -e
    0 1 * * * /usr/lib/cgi-bin/awstats.pl -config=hostname -update
    

5 Comments

Peter Says:

over 4 years ago

A word of warning: awstats version 6.2 has a vulnerability and hackers are trying to use it to break into this site.

Peter

Dan Scott Says:

over 2 years ago

Nice summary, Peter. One suggestion for increased security would be to, instead of chmod'ing the /var/cache/awstats directory to 777 (allowing read-write access to any user on the system), to chown the directory to www-data (so that only the user under which Apache runs has access to that directory):

sudo chown -R www-data /var/cache/awstats

Mehra Says:

over 2 years ago

So which version shall we go for ..

Anonymous Says:

about 1 year ago

Yeah that seemed a whole lot easier than emerge awstats...

Kraymer Says:

about 1 year ago

IMO site stats only matters for admins, especially for private websites. So I put it to an SSL-part of apache which is secured by SSLRequireSSL and digest authentication..

Have Your Say

I welcome constructive comments or questions but I reserve the right to delete any comments that displease me.

Who are you?

(Optional) If you enter an email address here I might email you back. Your email address will not be sold to spammers or shown anywhere

What do you have to say?