此页面提供两种自动更新GeoIP数据库的方法。git
MaxMind 提供 GeoIP 更新程序, 既能够更新GeoIP2数据库,也能够更新GeoIP 老版本数据库。请参照如下步骤:github
能够从GitHub 下载。数据库
得到一个 含有帐户信息 的 GeoIP.conf
.curl
您能够按照以下格式手写 (不推荐).url
1spa 2code 3crontab 4ip 5get |
# GeoIP.conf file - used by geoipupdate program to update databases # from http://www.maxmind.com UserId <span class="text-error">YOUR_USER_ID_HERE</span> LicenseKey <span class="text-error">YOUR_LICENSE_KEY_HERE</span> ProductIds <span class="text-error">YOUR_PRODUCT_IDS_HERE</span> |
运行 geoipupdate
. 能够在Unix上用crontab完成全自动:
1 2 3 4 |
# top of crontab MAILTO=your@email.com 0 12 * * 3 /usr/local/bin/geoipupdate # end of crontab |
该crontab每周三中午运行,而且email是否完成。运行请输入指令:
1 |
$ crontab cronfile |
若是你有防火墙, geoipupdate 要求 DNS 和 HTTPS (443) 端口打开.
推荐用于不能用更新的系统,如Windows
去GeoIP download page 使用直接下载. 若是你使用 wget
或者 curl
指令,URL须要用引号括起来.