Blog信息 |
blog名称: 日志总数:1304 评论数量:2242 留言数量:5 访问次数:7630259 建立时间:2006年5月29日 |

| |
[网络与系统管理]awstats+Geo-IP安装 软件技术
lhwork 发表于 2007/2/10 16:35:35 |
cd /usr/local/
wget http://nchc.dl.sourceforge.net/sourceforge/awstats/awstats-6.5.tar.gz
tar -zxvf awstats-6.5.tar.gz
ln -s /usr/local/awstats-6.5.tar.gz /usr/local/awstats
cd /usr/local/awstats/tools
perl ./awstats_configure.pl (按照提示进行安装)
mv /etc/awstats/awstats_mysite.com_conf /etc/awstats/common.conf
添加新的配置文件:
Include "common.conf"
LogFile="/usr/apache/logs/mysite.net_log"
SiteDomain="www.mysite.net"
HostAliases="mysite.net"
修改apache.conf,加上mysite.net的日志文件
CustomLog logs/mysite.net_log "combined"
添加apache.conf
<VirtualHost **.**.**.**>
ServerName awstats.mysite.com
DocumentRoot /usr/local/awstats/wwwroot/
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
CustomLog logs/mysite.com_log "combined"
</VirtualHost>
配置Geo-IP:
Geo-IP C-API
wget http://www.maxmind.com/download/geoip/api/c/GeoIP-1.3.8.tar.gz
tar -zxvf GeoIP-1.3.8.tar.gz
cd GeoIP-1.3.8
./configure
make
make install(root)
Geo-IP Perl-API
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 install(root)
Geo::IPfree
wget http://search.cpan.org/CPAN/authors/id/G/GM/GMPASSOS/Geo-IPfree-0.2.tar.gz
tar -zxvf Geo-IPfree-0.2.tar.gz
cd Geo-IPfree-0.2
perl Makefile.PL
make
make install(root)
此时报错:
[root @ws Geo-IP-1.27]# perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl --config=mysite.com
Error: Plugin load for plugin 'geoip' failed with return code: Error:
Can't locate Geo/IP/PurePerl.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.5/i386-linux-thread-multi
Geo-IP-PurePerl
wget http://search.cpan.org/CPAN/authors/id/T/TJ/TJMATHER/Geo-IP-PurePerl-1.14.tar.gz
tar -zxvf Geo-IP-PurePerl-1.14.tar.gz
cd Geo-IP-PurePerl-1.14
perl Makefile.PL
make
make install(root)
Geo-IP C-API ( http://www.maxmind.com/download/geoip/api/c/ )
Geo-IP Perl-API ( http://www.maxmind.com/download/geoip/api/perl/ )
这两个是一组,必须先编译安装C的,再编译安装perl的
Geo::IPfree ( http://search.cpan.org/author/GMPASSOS/Geo-IPfree-0.2/ )
这单独是一个
上面两个不能同时在awstats里面用,否则会报错说冲突
安装国家数据库:
wget http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
MaxMind's GeoLiteCity database
gzip -d GeoLiteCity.dat.gz
复制GeoLiteCity.dat到/usr/local/share/GeoIP/下,然后修改awstats.yoursitenam.conf中的
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoLiteCity.dat"
patch:国内主要搜索引擎的搜索结果页定义(源至chedong‘s blog)
http://www.chedong.com/tech/awstats_6.5_patch.tgz
AWStats升级到6.5:补充更新
1 直接复制lib到awstats/lib的下;
2 将GeoIP.dat文件复制到 /usr/local/share/GeoIP/ 下;
3 修改awstats.chedong.conf 成你需要的配置文件;
更新后包含国内主要搜索引擎的搜索结果页定义:search_engines.pm和蜘蛛定义:robots.pm 只需要覆盖原有lib\目录下的文件即可。
NotPageList="css js class gif jpg jpeg png bmp ico swf xml rdf cgi mp3"
LoadPlugin="tooltips"
LoadPlugin="decodeutfkeys"
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat"
再下载最新的GeoIP 国家地址库后,解包放到/usr/local/share/GeoIP/GeoIP.dat下面。 |
|
|