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.
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
You should have already file called GeoIP.conf, if not you can copy paste:
$ nano /etc/GeoIP.conf
# Please see https://dev.maxmind.com/geoip/geoipupdate/ 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 # https://www.maxmind.com/en/my_license_key. 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 : https://dev.maxmind.com/geoip/geoipupdate/
run the commande :
$ geoipupdate -v
( 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.