This works for Ubuntu, Debian and CentOS distributions. You need a valid license key from MaxMind. This is available as a subscription at a nominal fee.
If you have installed GeoIP successfully, you should have the geoipupdate program. If you don’t, you need the run the following.
Install over Ubuntu or Debian:
[code lang=”bash”]sudo apt-get install geoip-bin geoip-database libgeoip-dev[/code]
Install over CentOS:
[code lang=”bash”]sudo yum install re2c geoip geoip-data geoip-devel[/code]
Both libgeoip-dev and geoip-devel are required for compiling PHP’s GeoIP.
Once you run geoipupdate the first time, it tells you about a missing GeoIP file.
[code lang=”bash”]root@gladlycode:~# geoipupdate
Error opening GeoIP Configuration file /etc/GeoIP.conf[/code]
Now you copy over from the default file:
[code lang=”bash”]mv /etc/GeoIP.conf.default /etc/GeoIP.conf[/code]
If you now run geoipupdate, you get the following:
MD5 Digest of installed database is f5c2f7eed9331dcaa99b7a6b4633b684