GeoIP Lookup Installation on FreeBSD

Posted on April 02, 2015 in systems, unix, freebsd

First of all, we install the geoiplookup binay :

cd /usr/ports/net/GeoIP
make config-recursive && make install clean

Next, we download and install the GeoIP databases :

cd /usr/local/share/GeoIP/

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz

gunzip GeoIP.dat.gz
gunzip GeoIPASNum.dat.gz
gunzip GeoLiteCity.dat.gz

We type :

/usr/local/bin/geoiplookup -f /usr/local/share/GeoIP/GeoLiteCity.dat 8.8.8.8

And we obtain :

GeoIP City Edition, Rev 1: US, CA, California, Mountain View, 94040, 37.386002, -122.083801, 807, 650