Free DNS provides easy shared DNS hosting & URL forwarding

Tuesday, November 29, 2011

Setup GeoIP for PHP5 on Ubuntu Server

I lost a few hours on this, although I done it sometime ago. To make sure I don't forget it again, here it is:
  1. Install geoip packages:
    sudo apt-get install geoip-bin php5-geoip
  2. Download GeoIP Lite version:
    wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -O /tmp/GeoLiteCity.dat.gz
  3. Unzip GeoIP Lite to /usr/share/GeoIP/GeoIPCity.dat (this is what I forgot: to rename the file):
    sudo gunzip -c /tmp/GeoLiteCity.dat.gz > /usr/share/GeoIP/GeoIPCity.dat
  4. Reload apache
    sudo /etc/init.d/apache2 reload