Download, install and configure perl GeoIP module manually

by jagbir on April 3, 2009

After a try to install perl Geo::IP through cpan, and spending some moments to resovle error about missing C api library etc. I’ve opted for manual install which goes quite smooth.

Here are the steps which I followed on my CentOS 5.2 server. Please note that the version of software mentioned here might be outdated at the point of your reading, therefore, you should visit the relevant site and fetch latest one.

Step 1. Download, compile and install maxmind’s C API:

# cd /usr/src
# wget
# tar xzf GeoIP-1.4.3.tar.gz
# cd GeoIP-1.4.3
# ./configure; make; make install

Step 2. Download, compile and install the module:

# cd /usr/src
# wget
# tar xzf Geo-IP-1.35.tar.gz
# cd Geo-IP-1.35
# perl Makefile.PL LIBS=’-L/usr/local/lib’ INC=’-L/usr/local/include’
# make ; make install

here, we need to specify the path for library and header files so that module can include them. Module is installed and ready for use.

If you have purchased a subscription to update GeoIPCity database reguarly, proceed to next step.
(Optional) Step 3. Configure subscription information to update Geo::IP database regularly:

# vim /usr/local/etc/GeoIP.conf
## add following lines, replace proper values:
ProductIds PRODUCT-ID # usually the value 133 represent Geo::IP module

Save, exit and then execute update to fetch latest database:

# /usr/local/bin/geoipupdate

It’s better to setup cron to update Geo::IP database on weekly basis:

# crontab -e
0 12 * * 6 /usr/local/bin/geoipupdate

That’s all we need to setup Geo::IP module.

Previous post:

Next post: