awstats安装

1.事先安装好Apache perl

2.安装awstats的命令(将awstats安装在/usr/local/awstats目录)
mkdir /var/lib/
wget http://prdownloads.sourceforge.net/awstats/awstats-6.95.tar.gz
tar zxvf awstats-6.95.tar.gz
mv awstats-6.95 /usr/local/awstats
cd /usr/local/awstats/tools/
perl awstats_configure.pl

3.Perl脚本awstats_configure.pl安装过程
[root@localhost]# perl awstats_configure.pl
----- AWStats awstats_configure 1.0 (build 1.8) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).
-----> Running OS detected: Linux, BSD or Unix
-----> Check for web server install
  Found Web server Apache config file '/usr/local/apache/conf/httpd.conf'
-----> Check and complete web server config file '/usr/local/apache/conf/httpd.conf'
Warning: You Apache config file contains directives to write 'common' log files
This means that some features can't work (os, browsers and keywords detection).
Do you want me to setup Apache to write 'combined' log files [y/N] ? y  使用combined格式的访问日志
  Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'
  Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'
  Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'
  Add 'ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'
  Add '<Directory>' directive
  AWStats directives added to Apache config file.
-----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
  File awstats.model.conf updated.
-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y  创建一个awstats的配置文件
-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:  输入配置文件名称
> www.test.com
-----> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):  输入配置文件的路径
> /etc/awstats
-----> Create config file '/usr/local/awstats/awstats.www.test.com.conf'
 Config file /usr/local/awstats/awstats.www.test.com.conf created.
-----> Restart Web server with '/sbin/service httpd restart'
httpd: unrecognized service  注意这里会重启apache
-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.test.com
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...

A SIMPLE config file has been created: /usr/local/awstats/awstats.www.test.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.test.com' with command:
> perl awstats.pl -update -config=www.test.com
You can also read your statistics for 'www.test.com' with URL:
> http://localhost/awstats/awstats.pl?config=www.test.com
Press ENTER to finish...
 
4. 修改.conf配置
   vi /etc/awstats/awstats.www.test.com.conf
   LogFile="/var/log/httpd/access_log"
   改为要分析的Apache日志路径与文件名
   (1)多日志合并分析
      LogFile="/usr/local/awstats/tools/logresolvemerge.pl /var/apachelogs/20100220.log /var/apachelogs/20100220.log|"
      LogFile="/opt/awstats/tools/logresolvemerge.pl /var/apachelogs/201002*.log|"
      LogFile="/var/log/httpd/access_log.yoyi.%DD-%MM-%YYYY"
   (2)分析使用gzip压缩过的日志文件
      LogFile="gzip -d </var/log/apache/access.log.gz|"
   
   注销LoadPlugin="decodeutfkeys"前面的#  否则搜索关键字可能有乱码
5. 配置awstats数据目录
   mkdir -p /var/lib/awstats
6. 更新分析报告
   perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.test.com -update
7. 查看分析报告
   http://localhost/awstats/awstats.pl?config=www.test.com
   这里的 www.test.com对应/usr/local/awstats/awstats.www.test.com.conf 中的 www.test.com
8. qqhostinfo
   awstats是可以增加插件的。这个qqhostinfo插件,可以在访问主机表格中增加一列,显示ip对应的位置。
   插件下载并复制到 awstats/plugins/目录下:
   1. 首先下载插件(qqhostinfo.pm)。把它放在awstats/wwwroot/cgi-bin/plugins中。
   2. 下载分析QQWry.dat的perl脚本(qqwry.pl)。放在同一目录。
   3. 修改,qqwry.pl中:
      vi /usr/local/awstats/wwwroot/cgi-bin/plugins/qqwry.pl
      ./QQWry.Dat 修改为 ${DIR}/plugins/QQWry.Dat
   4. 下载QQWry.Dat放在同一目录中,注意文件名一定要是QQWry.Dat
   5. 编辑你得awstats配置文件,大概在LoadPlugin="hostinfo"的后面增加一行
      LoadPlugin="qqhostinfo"
   6. 安装 使用Net_XWhois 模块 qqhostinfo 插件需要安装 Net-XWhois 模块
      tar xvf  Net-XWhois-0.70.tar
      cd Net-XWhois-0.70
      perl  Makefile.PL
      make
      make install

你可能感兴趣的:(职场,awstats,休闲)