Install GeoIP on CPanel CentOS server

 

December 29, 2009 Server Administration

nstall GeoIP binaries:

yum install GeoIP GeoIP-devel

Download more databases from MaxMind and put them into /opt/geoip/share/GeoIP/:

http://geolite.maxmind.com/download/geoip/database/

Install CPanel EasyApache GeoIP module:

wget http://twiki.cpanel.net/twiki/pub/EasyApache3/CustomMods/custom_opt_mod-mod_geoip.tar.gz

tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz

  • Run EasyApache and select mod GeoIP:

/scripts/easyapache

Configure GeoIP by adding to httpd.conf (or pre_virtualhost_global.conf):

  • /usr/local/apache/conf/httpd.conf
  • /usr/local/apache/conf/includes/pre_virtualhost_global.conf

GeoIPEnable On
GeoIPDBFile "/opt/geoip/share/GeoIP/GeoIP.dat"

Install GeoIP PHP Extension:

  • Make sure that /tmp is mounted with exec option:

mount -o,remount,rw,exec /tmp

  • Install geoip via PECL:

pecl install geoip

Restart Apache:

/scripts/restartsrv_apache

Tags:

Leave a Reply