Debian 9: Apache 2 Using mod_maxminddb

Discussion in 'Tips/Tricks/Mods' started by, Jul 16, 2018.

  1. Well-Known Member HowtoForge Supporter

    There is no much support for the GEO-IP module using maxminddb. If you don't use geoip, you won't need that, if you do, you might :)

    apt-get install git apache2-dev build-essential libmaxminddb-dev
    cd /usr/local/src/
    Now use either
    git clone
    git clone
    to get a patched module, see the commits, for some they might be useful. up to you

    cd mod_maxminddb
    make install
    map your infos you need ( check the docs or source for more examples )
    If you have no subscription you need a little cronjob-helper:

    if [ ! -d "/usr/local/share/maxminddb/" ]; then
        mkdir -p /usr/local/share/maxminddb
    wget -N -q -O /tmp/GeoLite2-City.tar.gz
    tar -xf /tmp/GeoLite2-City.tar.gz -C /tmp/
    find /tmp/GeoLite2-City_* | grep "GeoLite2-City.mmdb" | xargs -I{} mv {} /usr/local/share/maxminddb/GeoLite2-City.mmdb
    wget -N -q -O /tmp/GeoLite2-Country.tar.gz
    tar -xf /tmp/GeoLite2-Country.tar.gz -C /tmp/
    find /tmp/GeoLite2-Country_* | grep "GeoLite2-Country.mmdb" | xargs -I{} mv {} /usr/local/share/maxminddb/GeoLite2-Country.mmdb
    wget -N -q -O /tmp/GeoLite2-ASN.tar.gz
    tar -xf /tmp/GeoLite2-ASN.tar.gz -C /tmp/
    find /tmp/GeoLite2-ASN_* | grep "GeoLite2-ASN.mmdb" | xargs -I{} mv {} /usr/local/share/maxminddb/GeoLite2-ASN.mmdb
    rm -rf /tmp/GeoLite2-*
    service apache2 reload
    chmod +x /etc/cron.daily/maxminddb
    a2enmod maxminddb
    service apache2 restart
    Last edited: Jul 18, 2018
    Jesse Norell and till like this.

Share This Page