Finding the geographical location of an ip address couldn't be simpler. In a few minutes, you'll have the foundation of a geotargeting/geotracking setup on your Debian based server.
Here's how to install maxmind geolite city on debian lenny 64 bit.
With root privileges, follow the following steps.
apt-get install libapache2-mod-geoip
DOWNLOAD AND INSTALL THE GeoLite City DATABASE
gunzip GeoLiteCity.dat.gz
Next, find the file /etc/apache2/mods-available/geoip.conf
And edit it so that it's contents look like this:
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat Standard
GeoIPDBFile /usr/share/GeoIP/GeoLiteCity.dat Standard
</IfModule>
Save and close the file after making your edits.
Restart apache with this command:
Now test to see if it works. Create and run a PHP file:
It's contents should be as follows:
<?php /* Uses mod-geoip to query the MaxMind GeoLite City binary database and returns geographic information based on the client's IP address */ ?>
After running the above script, you should see information describing your location. If you don't, well, look over the instructions again and see if you skipped a step.
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.
Add comment