C library for the MaxMind DB file format http://maxmind.github.io/libmaxminddb/ https://github.com/maxmind/libmaxminddb MaxMind DB File Format Specification http://maxmind.github.io/MaxMind-DB/ http://maxmind.github.io/libmaxminddb/ http://maxmind.github.io/libmaxminddb/#example GeoLite2 Free Downloadable Databases https://dev.maxmind.com/geoip/geoip2/geolite2/ GeoLite2 Country http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz GeoLite2 City http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz FreeBSD: cd /usr/ports/net/libmaxminddb && make install clean [ -d /usr/local/share/GeoIP ] || mkdir -p /usr/local/share/GeoIP wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz -O/tmp/GeoLite2-Country.tar.gz tar -xz --cd /tmp -f /tmp/GeoLite2-Country.tar.gz $(tar -tzf /tmp/GeoLite2-Country.tar.gz | grep GeoLite2-Country.mmdb) mv /tmp/$(tar -tzf /tmp/GeoLite2-Country.tar.gz | grep GeoLite2-Country.mmdb) /usr/local/share/GeoIP/ rm -rf /tmp/$(tar -tzf /tmp/GeoLite2-Country.tar.gz | grep GeoLite2-Country.mmdb | xargs dirname) /tmp/GeoLite2-Country.tar.gz CentOS yum install -y libmaxminddb libmaxminddb-devel [ -d /usr/share/GeoIP ] || mkdir -p /usr/share/GeoIP wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz -O/tmp/GeoLite2-Country.tar.gz tar -xz --directory=/tmp -f /tmp/GeoLite2-Country.tar.gz $(tar -tzf /tmp/GeoLite2-Country.tar.gz | grep GeoLite2-Country.mmdb) mv /tmp/$(tar -tzf /tmp/GeoLite2-Country.tar.gz | grep GeoLite2-Country.mmdb) /usr/share/GeoIP/ rm -rf /tmp/$(tar -tzf /tmp/GeoLite2-Country.tar.gz | grep GeoLite2-Country.mmdb | xargs dirname) /tmp/GeoLite2-Country.tar.gz Ubuntu: apt-get update && apt-get install -y libmaxminddb0 libmaxminddb-dev mmdb-bin [ -d /usr/share/GeoIP ] || mkdir -p /usr/share/GeoIP wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz -O/tmp/GeoLite2-Country.tar.gz tar -xz --directory=/tmp -f /tmp/GeoLite2-Country.tar.gz $(tar -tzf /tmp/GeoLite2-Country.tar.gz | grep GeoLite2-Country.mmdb) mv /tmp/$(tar -tzf /tmp/GeoLite2-Country.tar.gz | grep GeoLite2-Country.mmdb) /usr/share/GeoIP/ rm -rf /tmp/$(tar -tzf /tmp/GeoLite2-Country.tar.gz | grep GeoLite2-Country.mmdb | xargs dirname) /tmp/GeoLite2-Country.tar.gz