1.當你安裝號Awstats後,報表會反解IP位置,當然你可以加入外掛讓Awstats顯示國家與程式還有組織的訊息
2.下載所需要的資料
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
3.建立資料夾
sudo mkdir /usr/share/GeoIP
4.移檔與解壓縮
mv GeoIP.dat.gz /usr/share/GeoIP/
gunzip /usr/share/GeoIP/GeoIP.dat.gz
mv GeoLiteCity.dat.gz /usr/share/GeoIP/
gunzip /usr/share/GeoIP/GeoLiteCity.dat.gz
mv GeoIPASNum.dat.gz /usr/share/GeoIP/
gunzip /usr/share/GeoIP/GeoIPASNum.dat.gz
5.下載與安裝GeoIP套件
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar -xvzf GeoIP.tar.gz
cd GeoIP-1.4.6
./configure
make
make check
sudo make install
*注意你在./configur,查看是否有錯誤,版主出現少一個套件名稱
configure: error: Zlib header (zlib.h) not found. Tor requires zlib to build. You may need to install a zlib development package.
安裝缺少的套件
sudo apt-get install zlib1g-dev
記得在重新./configure 後,在接下去make......等等步驟
6.下載安裝編譯程式
wget http://geolite.maxmind.com/download/geoip/api/perl/Geo-IP-1.38.tar.gz
tar -xvzf Geo-IP-1.38.tar.gz
cd Geo-IP-1.38
perl Makefile.PL LIBS='-L/usr/local/lib'
make
make test
sudo make install
7.修改sudo vi /etc/awstats/awstats.www.conf檔案
DNSLOOKUP=0
LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/share/GeoIP/GeoLiteCity.dat"
LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /usr/share/GeoIP/GeoIPASNum.dat"
8.完成
參考文件:
http://www.antezeta.com/awstats/geoip.html
Leave a Reply