This short install guide will assume that your server is running Ubuntu. I have tested this guide on two systems. One, a 64-bit 8.04 system, and the second a 32-bit 8.10 system.
To complete this install guide, you'll need to have the Apache web server running with PHP configured.
I'll first walk you through downloading and installing the GeoLite City binary database.
First, make a temporary directory to download the GeoLite City database.
Now move into the directory that you just created.
Now, that you're in the /tmp/geoip directory, go ahead and download the GeoLite City binary database from MaxMind.
You'll notice that the database is gzip compressed, so you'll have to uncompress the database before you can use it.
Now, it's time to copy the uncompressed database to the location where it will be accessed by the mod-geoip Apache module and also by the C API binary.
First create the GeoIP directory
Now, move the GeoLite City binary database to it's new location.
NOw you need to install the GeoIP C library. Nothing's going to work unless you have this library installed.
Here's all you have to do.
If you're not already there, go back to the directory you created earlier in the /tmp directory.
Now download the GeoIP C library.
Extract the archived GeoIP C library that you just downloaded.
Now move to the new directory that was created when you extracted the archived GeoIP C library.
Now, configure and install the GeoIP C library by issuing the following commands.
Installing the mod-geoip module on Ubuntu Linux (and probably other Debian variants) is done easily with the following command.
(Keep in mind though, that when a newer version of mod-geoip is released, the proper version number will need to replace the 2.1.2 version in the above example. Also, the install command might work by removing the version number from the package. However, the following is what I used at the time of this writing to install mod-geoip.)
Nothing's going to work unless mod-geoip is enabled in your apache2 configuration. You'll need the following lines in your apache2.conf file (located on Ubuntu systems at /etc/apache2/apache2.conf)
Restart Apache so your changes will take effect by entering the following command.
Now that you've installed MaxMind's GeoLite City binary database, the GeoIP C library, and the mod-geoip module for the Apache web server, you should now test your installation with a simple PHP script that will query the GeoLite City datbase against your IP address and (hopefully) print out some information about your location.
Now when you call the script in a browser, you should see some information that describes your geographic location.
Note: As of January 19, 2009 I am in the process of moving this site to a new server from Creativevps.com. At this time, I have not installed the GeoIP software on this machine and therefore you will not see any script output below.
Netdip.com is an excellent web site that's powered by TYPO3 and other great open source software. Netdip.com is also a fat free alternative to ice cream.