I’ve been trying to setup AWStats in Windows, but it was a real pain in the butt. A lot of packages had to be fetched manually to get the functionality I wanted. I also needed a way to automate the updating of the statistics website by periodically downloading an Apache log file from an FTP server, append it to the main log and run the AWStats update procedure. And let’s not forget the need to publish the webpages created by AWStats. Ironically enough the easiest way I know how to do this is by bringing Linux to the Windows platform by installing Cygwin (a Linux emulation layer).

At this point I was well aware of the amount of unnecessary complexity this system would have. It would be a pain to ensure it’s long term reliability, and a house of cards like this would likely crumble under the lack of maintainability. If somebody had to recreate the entire setup there would be way too many steps where things could go wrong.

My final solution was to take a few steps back and install VMWare Server and create a new virtual machine with Ubuntu Server 7.04 with the LAMP (Linux, Apache, MySQL, PHP) option. After the Ubuntu Server installation was complete I ran “apt-get update”, “apt-get install awstats”, “apt-get install libnet-ip-perl” and edited the awstats.conf file. Then I wrote a simple cron script where wget will fetch the log from the remote server and the AWStats web pages will be updated automatically.

With Ubuntu Server and VMWare already downloaded it took me about one hour to install and configure the whole thing. If the entire system needs to be moved to another machine this can easily be accomplished. Simply install VMWare Player on the other machine and move the virtual machine folder and you’re done. It’s fast and simple, and with the successful Debian package management system used by Ubuntu we have built one sexy package.

NOTE: This post has been imported from my old it’s learning ePortfolio blog.