Automatic Updates for GeoIP2 and GeoIP Legacy Databases

This page provides two methods for automatically updating GeoIP2 and GeoIP Legacy binary databases.

Using GeoIP Update

MaxMind provides the GeoIP Update program, which performs automatic updates for both GeoIP2 and GeoIP Legacy binary databases. Please follow the instructions below.

Step 1 – Install GeoIP Update

Install GeoIP Update. The latest release may be downloaded from GitHub Releases. See here for installation instructions.

If you are using an older version of GeoIP Update, you may need to upgrade to GeoIP Update 4.x or later version. The 4.x and later versions meet our requirement for using TLS 1.2 or greater for all requests to our servers to keep your data secure.

Please see our upgrade guide for more information on upgrading from an older version of GeoIP Update.

Step 2 – Obtain GeoIP.conf with Account Information

For Paid GeoIP2 and GeoIP Legacy Databases

Get a partially pre-filled configuration file (may require authentication) and save it in your configuration directory (e.g., /usr/local/etc/) as GeoIP.conf. You will need to replace the YOUR_LICENSE_KEY_HERE placeholder with an active license key associated with your MaxMind account. You can see your license key information on your account License Keys page.

You may also write this file by hand using the template below (not recommended).

# GeoIP.conf file - used by geoipupdate program to update databases
# from http://www.maxmind.com
AccountID YOUR_ACCOUNT_ID_HERE
LicenseKey YOUR_LICENSE_KEY_HERE
EditionIDs YOUR_EDITION_IDS_HERE

Note that for geoipupdate versions less than 2.5.0, use UserId instead of AccountID and ProductIds instead of EditionIDs.

For Free GeoLite2 Databases

The GeoIP Update program will also work without an account to retrieve the GeoLite2 databases. Please use the following GeoIP.conf file:

# The following AccountID and LicenseKey are required placeholders.
# For geoipupdate versions earlier than 2.5.0, use UserId here instead of AccountID.
AccountID 0
LicenseKey 000000000000

# Include one or more of the following edition IDs:
# * GeoLite2-City - GeoLite 2 City
# * GeoLite2-Country - GeoLite2 Country
# For geoipupdate versions earlier than 2.5.0, use ProductIds here instead of EditionIDs.
EditionIDs GeoLite2-City GeoLite2-Country

Step 3 – Run GeoIP Update

Run geoipupdate. To fully automate this process on Linux or Unix, use a crontab file like:

# top of crontab
MAILTO=your@email.com

59 21 * * 5 /usr/local/bin/geoipupdate
# end of crontab

This crontab file would run every week, and it would email you the results.

If you are running a firewall, geoipupdate requires that the DNS and HTTPS (443) ports be open.

Direct Downloads

This is only recommended for systems unable to use GeoIP Update.

In order to download the databases from a script or program, please use the “direct download URL” on our GeoIP download page and make the following changes:

  • Replace /geoip_download_by_token with /geoip_download
  • Replace token=XXXX with license_key=YOUR_LICENSE_KEY. You will need to replace the YOUR_LICENSE_KEY placeholder with an active license key associated with your MaxMind account.
  • If you wish to always download the latest database, remove the date parameter from the URL.
  • If you are using wget or curl from a shell script, please be sure to quote the URL.

This download will return a compressed file in gzip format, which can be uncompressed using a program like 7-Zip or gzip.

Download Limits

MaxMind reserves the right to limit the number of downloads made within a limited period of time.