1) Download and install GeoIP database
# cd /usr/local/src/
# wget -c http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz
# tar -xzf GeoIP-1.4.6.tar.gz
# cd GeoIP-1.4.6/
# ./configure
# make
# make install
2) Give apache user to read permission to that datbase file
# chown nobody.nobody /usr/local/share/GeoIP/GeoIP.dat
# echo ‘/usr/local/lib ‘ > /etc/ld.so.conf.d/geio.conf
# ldconfig
3) Download and install mod_geoip
# cd /usr/local/src/
# wget -c http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.5.tar.gz
# tar -xzf mod_geoip2_1.2.5.tar.gz
# cd mod_geoip2_1.2.5/
# /usr/local/apache/bin/apxs -lGeoIP -cia mod_geoip.c
4) Create a file called /usr/local/apache/conf/geoip.conf and add the following content
# cat >> /usr/local/apache/conf/geoip.conf << EOF
LoadModule geoip_module modules/mod_geoip.so
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat MemoryCache
</IfModule>
EOF
5) Add this file to apache included custom file list
echo ‘Include “/usr/local/apache/conf/geoip.conf” ‘ >> /usr/local/apache/conf/includes/pre_main_global.conf
6) Rebuild httpd.conf and restart apache.
# /scripts/rebuildhttpdconf
# /scripts/restartsrv httpd