2007-10-10: Thanks to James Rice who notified us of version 1.4.3. 2007-02-21: Thanks to Daniel Wallace who notified us of version 1.4.2. 2007-01-13: Thanks to Daniel Wallace who notified us of version 1.4.1. 2006-09-25: Thanks to Oleg Nerus who notified us of version 1.4.0. 2006-05-21: Thanks to Florian Burka who notified us of the availability of version 1.3.17.
With a text editor, add the directory -------------------------------------------------------------------------------------------------
另一個模組是Geo::IP(資料較常更新,速度較快)
安裝方式如下:
wget
http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.2.tar.gz
tar zxvf GeoIP-1.4.2.tar.gz
cd GeoIP-1.4.2
./configure
make
make check
make install
echo '/usr/local/lib' >> /etc/ld.so.conf
/sbin/ldconfig /etc/ld.so.conf
cd ..
wget
http://www.maxmind.com/download/geoip/api/perl/Geo-IP-1.27.tar.gz
tar zxvf Geo-IP-1.27.tar.gz
cd Geo-IP-1.27
perl Makefile.PL
make
make test
make install
cd ..
wget
http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
gunzip GeoIP.dat.gz
mv GeoIP.dat /etc/awstats/GeoIP.dat
修改/etc/awstats/awstats.yourdomain.conf
LoadPlugin="geoip GEOIP_STANDARD /etc/awstats/GeoIP.dat"
注意:您只能使用geoip或geoipfree其中一種,如果您先前使用geoipfree,現在改用geoip,則您需在geoipfree的那一行LoadPlugin前面加上#。
由於GeoIP.dat每個月初會更新一次,雖然網站上號稱是5/1更新,可是實際解壓縮後看到的檔案日期卻是5/3,故我們可以讓系統每個月排定一天去抓這個壓縮檔,解壓縮後,覆蓋掉/etc/awstats/GeoIP.dat這個檔即可。
首先編輯一個shell script:
vi /root/admin/updateGeoIP_dat.sh
#!/bin/bash
# Name: updateGeoIP_dat.sh
# Author: Andowson Chang (andowson [at] gmail [dot] com)
# Version: 0.1
# Last Modified: 2007-05-24
wget
http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
gunzip GeoIP.dat.gz
mv GeoIP.dat /etc/awstats/GeoIP.dat
我將它存在/root/admin/updateGeoIP_dat.sh,並更改檔案權限為可執行:
chmod 755 /root/admin/updateGeoIP_dat.sh
接著我們再設定crontab,例如我們排定每個月的5日凌晨2點,執行這個/root/admin/updateGeoIP_dat.sh:
# update GeoIP.dat (2007.05.24)
00 2 5 * * root /root/admin/updateGeoIP_dat.sh >/dev/null
No comments:
Post a Comment