This little post will guide you how to quickly install the MaxMind Geo::IP Perl Module that has different usages as shown in other posts. This module should be faster than the other MaxMind perl module (Geo::IP::PurePerl) but it will require to have the GeoIP C library installed in order to be compiled.
So first we will need to install the GeoIP C library (that includes also the free GeoLite Country database). Luckily this is available in the Debian repositories so we can simply install it using:
apt-get install libgeoip1 libgeoip-dev
Next, to install the GeoIP perl module, we need to download the perl module locally from MaxMind or from CPAN. The latest version available at the time I wrote this post is Geo-IP-1.27, but you should get the latest version available. Uncompress it and compile it as any perl module:
perl Makefile.PL make make test make install
For other Linux distributions you will have to use the same steps (first install the GeoIP C library and then download and compile the perl module). Note: if you are using Centos4 then you can skip all these steps as they have packaged the perl module in the “extras” repository so you can install it by simply running: