インストール

  • EPELリポジトリ
    yum install mod_geoip

設定

  • /etc/cron.monthly/updateGeoIP
    データベースの自動更新スクリプト
    wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
    gunzip GeoIP.dat.gz
    mv -f GeoIP.dat /usr/share/GeoIP/GeoIP.dat
    /sbin/restorecon -v /usr/share/GeoIP/GeoIP.dat
  • GeoIP が表示されない場合は、SELinux のラベルを確認。
    # ls -Z /usr/share/GeoIP/
    Good) unconfined_u:object_r:usr_t:s0
    NG)   unconfined_u:object_r:admin_home_t:s0
    • ラベルが正しくない場合は下記コマンドで修正する。 # sealert -a /var/log/audit/audit.log # /sbin/restorecon -v /usr/share/GeoIP/GeoIP.dat
    • ラベル修正後、httpd を再起動すること。 # service httpd restart

リンク