October 5, 2021 . 2 MIN READ
geoipupdate
ls -la /usr/share/GeoIP
cp /usr/share/GeoIP/GeoIP2-Country.mmdb /home/runcloud/webapps/app-staging21-2gamecms-com/storage/app/maxmind/GeoIP2-Country.mmdb
Add the MAXMIND repository to your Ubuntu Linux.
Copy to Clipboard
1
add-apt-repository ppa:maxmind/ppa
Install the package named GEOIPUPDATE.
Copy to Clipboard
1
apt-get update
2
apt-get install geoipupdate
Edit the GEOIPUPDATE configuration file.
Copy to Clipboard
1
vi /etc/GeoIP.conf
Insert your account ID and license key.
Here is the file, before our configuration.
Copy to Clipboard
1
AccountID YOUR_ACCOUNT_ID_HERE
2
LicenseKey YOUR_LICENSE_KEY_HERE
3
EditionIDs GeoLite2-Country GeoLite2-City
Here is the file, after our configuration.
Copy to Clipboard
1
AccountID 555555
2
LicenseKey AAAAAAAAAAAAAAAA
3
EditionIDs GeoLite2-Country GeoLite2-City
Update the database of GEOIP2.
Copy to Clipboard
1
geoipupdate -v
Verify the GEOIP2 database installation.
Copy to Clipboard
1
ls -la /usr/share/GeoIP
Here is the command output.
Copy to Clipboard
1
-rw-r–r– 1 root root 63884020 Apr 17 16:01 GeoLite2-City.mmdb
2
-rw-r–r– 1 root root 4013279 Apr 17 16:01 GeoLite2-Country.mmdb
You installed the GEOIP2 database for countries and cities.
Congratulations! You have finished the installation of GEOIPUPDATE.
# Regular cron job for the geoipupdate package, used to update GeoIP databases
#
# According to MaxMind: “The GeoIP2 and GeoIP Legacy Country and City databases
# are updated every Tuesday. The GeoIP2 ISP, GeoIP Legacy ISP and Organization
# databases are updated every one to two weeks. All other databases are updated
# on the first Tuesday of each month.”
# m h dom mon dow user command
47 6 * * 3 root test -x /usr/bin/geoipupdate && /usr/bin/geoipupdate
Resource: https://github.com/maxmind/geoipupdate
https://dev.maxmind.com/geoip/updating-databases?lang=en
http://manpages.ubuntu.com/manpages/bionic/man1/geoipupdate.1.html