Skip to content

Instantly share code, notes, and snippets.

@holly
Created July 28, 2024 13:32
Show Gist options
  • Save holly/6b0aebb633eb81b0f837e575b7e6fd2c to your computer and use it in GitHub Desktop.
Save holly/6b0aebb633eb81b0f837e575b7e6fd2c to your computer and use it in GitHub Desktop.
!/usr/bin/env bash
GEOIP_LICENSE_KEY=your_maxmind_geoip_license_key
for GEOIP_EDITION in GeoLite2-Country GeoLite2-ASN GeoLite2-City; do
tarball="${GEOIP_EDITION}.tar.gz"
curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=${GEOIP_EDITION}&license_key=${GEOIP_LICENSE_KEY}&suffix=tar.gz" -o $tarball
tar -xzf $tarball --wildcards "*/${GEOIP_EDITION}.mmdb" --strip=1
rm $tarball
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment