How to fix MaxMind GeoIP dat file 404 Not Found?

Just a few minutes ago, one of my cron that fetch current GeoIP.dat.gz file from MaxMind resolve to 404 Not Found.
The cron is running monthly to update its GeoIP database. Its an Apache2 mod_geoip.

This was the cron message:
/etc/cron.monthly/geoip:

--04:42:22-- http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
Resolving www.maxmind.com... 67.15.94.80
Connecting to www.maxmind.com|67.15.94.80|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://64.246.48.99/download/geoip/database/GeoIP.dat.gz [following]
--04:42:22-- http://64.246.48.99/download/geoip/database/GeoIP.dat.gz
Connecting to 64.246.48.99:80... connected.
HTTP request sent, awaiting response... 404 Not Found
04:42:22 ERROR 404: Not Found.

gunzip: ./GeoIP.dat.gz: No such file or directory

To fix this:

This involve root access, please be careful with anything you do with root.

[*] Login to your server via SSH as root
[*] Type:
nano /etc/cron.monthly/geoip
[*] Find this line:
/usr/bin/wget http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
[*] Update the line to look like this:
/usr/bin/wget http://www.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
[*] Test the new cron, type:
/etc/cron.monthly/geoip
[*] If you get something like this:
--05:06:31-- http://www.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
Resolving www.maxmind.com... 67.15.94.80
Connecting to www.maxmind.com|67.15.94.80|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz [following]
--05:06:33-- http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
Resolving geolite.maxmind.com... 64.246.48.99
Connecting to geolite.maxmind.com|64.246.48.99|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 570222 (557K) [application/x-gzip]
Saving to: `GeoIP.dat.gz'

100%[================================================================>] 570,222 488K/s in 1.1s

05:06:36 (488 KB/s) - `GeoIP.dat.gz' saved [570222/570222]
Then the cron is working.

MaxMind says they had to change the URL to a new one because they got million downloads at the old URL related to a malware.

Will write later on how to install mod_geoip on Apache2

Good luck.

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: