Skip to content

Instantly share code, notes, and snippets.

@revenkroz
revenkroz / download-geoipdb.sh
Last active July 22, 2024 15:16
Script to download MaxMind DB and extract it immediately
#!/bin/sh
export GEOIP_EDITION='GeoLite2-Country'
export GEOIP_LICENCE_KEY='secret_licence_key'
export GEOIP_TMP_FILE=geoip.tar.gz
curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=${GEOIP_EDITION}&license_key=${GEOIP_LICENCE_KEY}&suffix=tar.gz" > $GEOIP_TMP_FILE && \
tar -xzf $GEOIP_TMP_FILE --wildcards "*/${GEOIP_EDITION}.mmdb" --strip=1 && \
rm $GEOIP_TMP_FILE