apachegeoipmaxmind

maxminddb module for apache 2.4 on ubuntu error: The MaxMind DB file contains invalid metadata


here is my system information:

$ apachectl -v
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2016-07-14T12:32:26

$ cat /etc/*release* | grep -i dist
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"

$ uname -r
4.4.0-57-generic

i wish to install mod_maxminddb. i installed geoipupdate as a prerequisites and configured it to include not only geolite database, but either commercial one (using this)

$ ls -l /etc/GeoIP.conf
-rw-r--r-- 1 root root 818 Dec 24 18:29 /etc/GeoIP.conf
$ ls -l /usr/share/GeoIP/
total 0
$ geoipupdate
$ ls -l /usr/share/GeoIP/
total 187444
-rw-r--r-- 1 root root 112192399 Dec 24 18:46 GeoIP2-City.mmdb
-rw-r--r-- 1 root root   3012279 Dec 24 18:46 GeoIP2-Country.mmdb
-rw-r--r-- 1 root root  47721533 Dec 24 18:46 GeoIPCity.dat
-rw-r--r-- 1 root root   1699494 Dec 24 18:45 GeoIP.dat
-rw-r--r-- 1 root root   4189407 Dec 24 18:45 GeoIPISP.dat
-rw-r--r-- 1 root root   4299547 Dec 24 18:45 GeoLiteASNum.dat
-rw-r--r-- 1 root root  17760694 Dec 24 18:45 GeoLiteCity.dat
-rw-r--r-- 1 root root   1054583 Dec 24 18:45 GeoLiteCountry.dat

then complied and installed the mod_maxminddb, and when apache is configured to use the commercial databases, the following error is thrown

$ apachectl -M
AH00526: Syntax error on line 12 of /etc/apache2/mods-enabled/maxminddb.conf:
MaxMindDBFile: Failed to open /usr/share/GeoIP/GeoIPCity.dat: The MaxMind DB file contains invalid metadata

but that is not the case when apache is configured to use the geolite databases.

any ideas?


Solution

  • You didn't include your Apache config, but you appear to be trying to use mod_maxminddb with GeoIPCity.dat (GeoIP Legacy). It only works with GeoIP2. Adjust line 12 of maxminddb.conf to use GeoIP2-City.mmdb instead.