Enable GeoIP lookups on CentOS

GeoIP enables you to identify the location, organization, connection speed, and user type of your website visitors.

yum install GeoIP mod_geoip
cd /usr/share/GeoIP/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
rm -f *.gz

Edit the VirtualHost settings in httpd.conf

<ifmodule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat Standard
GeoIPDBFile /usr/share/GeoIP/GeoLiteCity.dat Standard

Restart Apache

/etc/init.d/httpd restart

Author: Leo Gaggl

ict business owner specialising in mobile learning systems. interests: sustainability, internet of things, ict for development, open innovation, agriculture

3 thoughts on “Enable GeoIP lookups on CentOS”

  1. Hi Sir, Good afternoon from Philippines. Im done exactly what your blog said and restarted httpd. Quick question, how to know the out put of this? Ive tried to check my site and search for links there and i found none of geoip lookups. Ive check the logs of httpd looks fine. How to know that geoip lookups is doing some lookup? Thanks

  2. You need to have some PHP code that actually does GeoIP lookups. Some content management systems or Log-analysers have this included. Installing the packages alone does not do any lookups

Leave a Reply