- Download .dat.gz databases from maxmind: http://geolite.maxmind.com/download/geoip/database/
- Install geoip via yum.
yum install GeoIP GeoIP-devel - You also might want to download database with ip addresses from Maxmind website and place it in
/usr/share/GeoIP(which is a default location of geoip upon installation). - Install PECL extension
pecl install geoip - Add
extension=geoip.soto your/etc/php.ini - Restart apache
/etc/init.d/httpd restart
For Ubuntu:
apt-get install libgeoip-dev libgeoip1
apt-get install php5-geoip
then you need to copy GeoLiteCity.dat.gz to /usr/share/GeoIP/ and extract it and rename it to GeoIPCity.dat
then restart your web server:
service apache2 restart