Skip to content

Updating to GeoLite2 databases

Brady Sullivan edited this page Mar 28, 2019 · 4 revisions

With the latest code changes, pushed Wednesday, March 27, 2019, MHN now uses the GeoLite2 database set for geolocation. The latest install scripts should work perfectly out of the box (if not, please don't hesitate to raise an issue). However, if you decide to update your MHN installation to the latest code, you will not immediately get the GeoLite2 databases and will most likely need to run some tweaks.

geoloc

If geoloc fails to spawn, check the latest lines in /var/log/mhn/geoloc.err

geoip2.database module not found

Run the following to download and install geoip2: sudo /opt/hpfeeds/env/bin/pip install geoip2 Then, sudo supervisorctl restart geoloc

No such file or directory: '/opt/GeoLite2-City.mmdb'

You will need to download and extract the latest GeoLite2 databases. MHN uses GeoLite2-City and GeoLite2-ASN. To get both, run the following commands as root (or run this script, https://gist.github.com/d1str0/e9967dfc52d1e0798be5bc914911f0f1):

cd /opt/
mkdir GeoLite2-City
wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz -O GeoLite2-City.tar.gz
tar xvf GeoLite2-City.tar.gz -C GeoLite2-City --strip-components 1
mv GeoLite2-City/GeoLite2-City.mmdb ./
mkdir GeoLite2-ASN
wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz -O GeoLite2-ASN.tar.gz
tar xvf GeoLite2-ASN.tar.gz -C GeoLite2-ASN --strip-components 1
mv GeoLite2-ASN/GeoLite2-ASN.mmdb ./