Geoip Update Database

ip bash geoip

How to install the “geoipupdate” software from MaxMind.

Create an account on Maxmind for GeoLite2. Go to:

Download and extract the appropriate tarball for your system.

You will end up with a directory named something like geoipupdate_4.0.0_linux_amd64 depending on the version and architecture.

Copy geoipupdate to where you want it to live. To install it to /usr/local/bin/geoipupdate, run the equivalent of sudo cp geoipupdate_4.0.0_linux_amd64/geoipupdate /usr/local/bin.

geoipupdate looks for the config file /usr/local/etc/GeoIP.conf by default.

add-apt-repository ppa:maxmind/ppa
apt update ;  apt upgrade ;  apt install geoipupdate

Before you can run the geoipupdate script, you’ll have to add our own credentials on /etc/GeoIP.conf

You should have already file called GeoIP.conf, if not you can copy paste:

 $ nano /etc/GeoIP.conf
# Please see for instructions
# on setting up geoipupdate, including information on how to download a
# pre-filled GeoIP.conf file.

# Enter your account ID and license key below. These are available from
# If you are only using free
# GeoLite databases, do not uncomment these lines.
 AccountID 0
 LicenseKey 000000000000
 EditionIDs GeoLite2-ASN GeoLite2-City GeoLite2-Country

More help here :

run the commande :

$ geoipupdate -v
 geoipupdate 3.1.1
 Opened License file /etc/GeoIP.conf
 AccountID 154662
 LicenseKey g6oO...
 Insert edition_id GeoLite2-ASN
 Insert edition_id GeoLite2-City
 Insert edition_id GeoLite2-Country  
 Read in license key /etc/GeoIP.conf
 Number of edition IDs 3
 No new updates available
 No new updates available
 No new updates available

( You need to file AccountID, LicenseKey, EditionIDs to run successfully the script.)

We are finally ready to update our MaxMind GeoLite database!

If that command succeeds, you can now execute the geoipupdate script below.

   mkdir /var/www/app/cache/ip_data
   sudo -u daemon geoipupdate -f /etc/GeoIP.conf -d /var/www/app/cache/ip_data -v
   chmod -R 777 /var/www/html/app/cache/ip_data

Because we added the -v option at the end, the script execution will respond with some data about the process and the results.

Previous Post