Installing the module

If you’re using Ubuntu or Debian, run the following command:

sudo apt-get install libapache2-mod-geoip

If you’re using a system that uses RPM, you can try the following command:

sudo yum install mod_geoip

If you can’t do either of these, you may have to build the module by hand.

Configuring the module

Open the GeoIP configuration file for the module. It is located at:

/etc/apache2/mods-enabled/geoip.conf`

Add the following lines to the bottom of the file (replace ‘/path/to/database.dat’ with the path to your GeoIP database):

GeoIPDBFile /path/to/database.dat
GeoIPScanProxyHeaders On

If you have multiple GeoIP databases (for example, a city one and an ISP one), you can add multiple GeoIPDBFile lines.

Restart the webserver and the GeoIP extension should now be loaded and working in Piwik > Settings > Geolocation.