Setting up awstats in ubuntu

# Install awstats package
sudo apt-get install awstats
# Edit a file called /etc/awstats/awstats.hostname.conf where hostname is the hostname. Put something like this in it:

LogFile=”/var/log/apache2/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/awstats 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

Thanks to http://www.petersblog.org/node/697