Documentation Index
Fetch the complete documentation index at: https://mintlify.com/msimerson/maxmind-geolite-mirror/llms.txt
Use this file to discover all available pages before exploring further.
maxmind-geolite-mirror is a global CLI tool you install once with npm and then run on a schedule to keep MaxMind’s GeoLite2 IP geolocation databases current on your server. This guide walks you from zero to a fully populated /usr/local/share/GeoIP/ directory with all three .mmdb files downloaded and ready to use.
Get a MaxMind license key
GeoLite2 databases require a free MaxMind account. Register at maxmind.com/en/geolite2/signup, then generate a license key from the My License Key section of your account portal.Keep the key handy — you will set it as the
MAXMIND_LICENSE_KEY environment variable in a later step.Install the CLI
Install the package globally with npm. Node.js v14.0.0 or later is required.This installs the
maxmind-geolite-mirror binary to your global npm bin directory (typically /usr/local/bin/maxmind-geolite-mirror).Create the database directory
The tool writes Ensure the user that will run the tool has write permission to this directory.
.mmdb files to /usr/local/share/GeoIP/ by default. Create the directory if it does not already exist:Set the license key
Export your MaxMind license key as an environment variable in your current shell session:Replace
your_key_here with the license key you generated in step 1. To make this permanent, add the export line to your shell profile (e.g. ~/.bashrc, ~/.zshrc) or your system’s environment configuration.Run the mirror
Execute the CLI to download all three GeoLite2 databases:The tool processes each database in series. For each file it checks whether a local copy already exists. If it does, a On subsequent runs, if the databases are already current, the output will instead show:
HEAD request with an If-Modified-Since header is sent to confirm whether the remote file is newer. If no local copy exists yet, the tool downloads immediately without a preliminary check. You will see output similar to:Downloaded files
After a successful run, your GeoIP directory contains the following files:| File | Description |
|---|---|
GeoLite2-Country.mmdb | Country-level geolocation data (country code, country name) |
GeoLite2-City.mmdb | City-level geolocation data (city, subdivision, postal code, coordinates) |
GeoLite2-ASN.mmdb | Autonomous System Number and organization name for each IP range |
If The tool will read
/usr/local/share/GeoIP is not writable by the user running the tool, set the MAXMIND_DB_DIR environment variable to a directory you do control:MAXMIND_DB_DIR at startup and write all database files to that path instead of the default.