My site is ad supported.

How To Auto Update MaxMind GeoIP Databases On Windows

Download Script Template (Requirements Included)


Description

The MaxMind GeoIP Databases are a freely available lookup to map an IP address to a geographical location. Naturally, this makes for ideal use in analytical systems such as AWStats (when configured to use GeoIP). These databases are updated, typically, once per month which makes it a great candidate for a "set it and forget it" automated update process.

Requirements

  • Update From the Web - Batch script available on this site.
  • Requirements for the above script (listed on the respective page). This process does require compressed file extraction.

Instructions

Tested on Windows Server 2003 and 2008.

The process or automatically updating the MaxMind GeoIP Databases is all handled by a single call to the Update From the Web batch script. All that is needed is for you provide the location where the resulting binary file should be extracted.

This batch script handles the update process:

@ECHO OFF
SETLOCAL

REM Edit the directory path below appropriately.
SET Directory="C:\Path\To\Save\Files"

REM Leave everything below here alone.
ECHO Script by: Jason Faulkner (http://jasonfaulkner.com)
ECHO.

SET BaseURL=http://geolite.maxmind.com/download/geoip/database
SET Switches=/F %Directory% /Z /A /W

CALL UpdateFromWeb %BaseURL%/GeoLiteCity.dat.gz %Switches%
CALL UpdateFromWeb %BaseURL%/GeoLiteCountry/GeoIP.dat.gz %Switches%
CALL UpdateFromWeb %BaseURL%/asnum/GeoIPASNum.dat.gz %Switches%

ENDLOCAL
  1. Save the above script to a batch file. Alternately, you can download the script template with required utilities included using the link at the top.
  2. Set a Windows Scheduled Task to run the respective batch file monthly.
  3. Test to ensure updates work.

Note: The URLs referenced above are current at the time of this writing. They are subject to change at any time.



My site is ad supported.