一、设置YUM源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
二、安装GeoIP
yum -y install GeoIP-update
安装后查看 /etc/cron.weekly目录
cd /etc/cron.weekly/
多了个 geoipupdate 脚本文件,用任务定是执行该脚本可实现定时更新 GeoIP库
三、设置定时任务
vim /etc/crontab
增加
0 * * * 6 root run-parts /etc/cron.weekly
每周六 0点执行
更新的GeoIP库文件在 /usr/share/GeoIP/ 目录
ll /usr/share/GeoIP/
可以通过查看 geoipupdate,获取 库文件的位置
cat /etc/cron.weekly/geoipupdate