How to install mod_geoip for apache2.4 On WHM/cPanel server

Mod_GeoIP module is used to get the geographic location of ipaddress of the visitor into the Apache web server. This module allows you to determine the visitor’s country, organization and location.

The latest version of Cpanel have easyapache4 by default and it supports only apache2.4 and newer versions. Also the conventional method of custom module installation will not work in easyapache4.

This article explains the detailed steps install mod_geoip for apache2.4 in server with Cpanel58.

Step1: Log in to your server via SSH.

Step2: Create the directory for saving Geoip database.

#mkdir /usr/share/GeoIP

Step3: Change the location to the newly created folder.

#cd /usr/share/GeoIP

Step4: Download and install GeoIP database.

#wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

Step5: Extract the downloaded database file.

#gzip -d GeoIP.dat.gz

Step6: Install necessary packages related to apache24.

#yum install ea-apache24-devel.x86_64 ea-apache24-tools.x86_64

Step7: Download the custom mod_geoip module for cPanel.

#wget https://github.com/maxmind/geoip-api-mod_geoip2/archive/1.2.10.tar.gz

Step8: Extract the downloaded file.

#tar -xvf 1.2.10.tar.gz

Step9: Change the location to extracted folder.

#cd geoip-api-mod_geoip2-1.2.10/

Step10: Install geoip as a shared module

#apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c

That's all.....

Leave a Reply

Your email address will not be published. Required fields are marked *