Linuxing Celebrating Life with Linux

2Nov/090

Download, install and configure perl GeoIP module manually

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:

Step 1. Download and install maxmind's C API:

1
2
3
4
5
$ cd /usr/src
$ wget http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.3.tar.gz
$ 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:

1
2
3
4
5
6
$ cd /usr/src
$ wget http://search.cpan.org/CPAN/authors/id/B/BO/BORISZ/Geo-IP-1.35.tar.gz
$ 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 LIBS and header files so that module can include them. Module is installed successfully.
If you have purchased a subscription for to update it's database regularly, proceed to next step otherwise module is ready for use.

(Optional) Step 3. If you have a subscription of GeoIP from maxmind, configure it now for auto update database regularly :

1
2
3
4
5
$ vim /usr/local/etc/GeoIP.conf
## add following lines, replace proper values:
LicenseKey YOUR-LICENCE-KEY
UserId YOUR-USERID
ProductIds PRODUCT-ID  # usually the value 133 represent Geo::IP module

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

1
$ /usr/local/bin/geoipupdate

It's better to setup cron to update Geo::IP database weekly:
# crontab -e

1
0 12 * * 6 /usr/local/bin/geoipupdate

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

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • Reddit
  • StumbleUpon
  • Twitter
Tagged as: , Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes