Installing awstats on Ubuntu Feisty

Last modified on July 24, 2026 • 2 min read • 304 words
I started to use awstats for creating the site statistics on our server.

I started to use awstats for creating the site statistics on our server. After installing the ubuntu package, there are still a few things that I had to do:

  1. Install libnet-ip-perl and libgeo-ipfree-perl in order to map the dns entries to countries.Download http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.2.tar.gzhttp://www.maxmind.com/download/geoip/api/perl/Geo-IP-1.27.tar.gzhttp://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gzhttp://www.maxmind.com/download/geoip/database/GeoIP.dat.gzhttp://www.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gzin  order to use the free, but non-open source versions of GeoIP.
  2. Since I use vhosts, I put for every vhost one configuration file into the /etc/awstats/ directory.
  3. Into the vhost-specific configuration file I only put directives that are different from the default configuration file /etc/awstats/awstats.conf. For my own vhost (jeltsch.org) these directives are as follows:LogFile="/var/log/apache2/jeltsch.org/access.log"LogFormat=1DNSLookup=1SiteDomain=“jeltsch.org"HostAliases=“ www.jeltsch.org  "AllowToUpdateStatsFromBrowser=1AllowFullYearView=3EnableLockForUpdate=1AllowAccessFromWebToAuthenticatedUsersOnly=1AllowAccessFromWebToFollowingAuthenticatedUsers=“jeltsch"DefaultFile=“index.html index.php"LoadPlugin=“geoipfree"If you want to use the non-OSS GeoIP stuff, replace the last line by the following:LoadPlugin=“geoip GEOIP_STANDARD /usr/local/share/perl/5.8.8/Geo/IP/GeoIP.dat"LoadPlugin=“geoip_city_maxmind GEOIP_STANDARD /usr/local/share/perl/5.8.8/Geo/IP/GeoLiteCity.dat"LoadPlugin=“geoip_org_maxmind GEOIP_STANDARD /usr/local/share/perl/5.8.8/Geo/IP/GeoIPASNum.dat"Compile the GeoIP-1.4.2 stuff according to the INSTALL file. You probably need to get some stuff first to be able to do the compilation. Execute apt-get install build-essential Compile Geo-IP-1.27 according to the INSTALL file. Unzip the 3 databases and put them into the /usr/local/share/perl/5.8.8/Geo/IP/ directory.
  4. In order to protect the statistics I limit access to authenticated users.The following lines has to be added to the vhost-specific apache configuration file /etc/apache2/sites-available/jeltsch.org:<Directory “/usr/lib/cgi-bin”>AllowOverride NoneOptions ExecCGI -MultiViews +SymLinksIfOwnerMatchOrder allow,denyAllow from allAuthType basic #added lineAuthName “cgi-bin restricted” #added lineAuthUserFile /etc/apache2/.htpasswd #added line #added lineRequire valid-user #added line #added lineThe you need to create the /etc/apache2/.htpasswd file and add a user password with the command:htpasswd -c /etc/apache2/.htpasswd username
  5. Now everything works apart from the images which awstats expects to be in the icon subdirectory of the document root for the vhost. I just created a link:ln -s /usr/share/awstats/icon /var/www/jeltsch.org/iconOn some Ubutu installs the log files cannot be accessed and even if you change the permissions tochomd -R 755 /var/log/apache2 they keep being switched back by the logrotation script. In order to fix that read this post  .