1、首先下载最新版的awstats至某目录中,而后进行安装配置的准备工作:
# mkdir /var/lib/awstats
# tar zxvf awstats-6.95.tar.gz
# mv awstats-6.95  /usr/local/awstats
2、配置awstats
# cd /usr/local/awstats
# mkdir -m 755 data
# perl tools/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
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> /etc/httpd/conf/httpd.conf      《---------此处需要给出httpd的主配置文件的位置以使得awstats可以添加新的配置项。如果此前已经做过此配置,则使用"none"略过此步。
Your web server config file(s) could not be found.
You will need to setup your web server manually to declare AWStats
script as a CGI, if you want to build reports dynamically.
See AWStats setup documentation (file docs/index.html)
-----> 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        《----------这里用来指定是否需要为某站点创建统计日志的配置文件,如果需要,则指定"y"。
-----> 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 '/etc/awstats/awstats.www.test.com.conf'
 Config file /etc/awstats/awstats.www.test.com.conf created.
-----> 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: /etc/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 build static report pages for 'www.test.com' with command:
> perl awstats.pl -output=pagetype -config=www.test.com
Press ENTER to finish...       《--------“回车”继续,并结束配置过程

3、调整前面为某站点创建的统计日志所需的配置文件中指定的、某站点实际使用的日志文件的路径
# vim /etc/awstats/awstats.www.test.com.conf
找到如下行:
LogFile="/var/log/httpd/mylog.log"
把后的日志文件的路径修改为您此站点实际日志文件的路径即可,如您的日志文件路径为“/var/log/httpd/access_log”,需要将上述行修改为如下行:
LogFile="/var/log/httpd/access_log"

4、手动更新网站的统计数据,以上面的www.test.com为例
# cd /usr/local/awstats/wwwroot/cgi-bin/
# perl awstats.pl -update -config=www.test.com
现在就可以在浏览器地址栏输入类似如下地址查看日志了:
# http://www.test.com/awstats/awstats.pl?config=www.test.com
注: 如果需要将某统计信息生成为静态的html页面,使用以下命令即可实现:
perl awstats.pl -output=pagetype -config=www.test.com > awstats.www.test.com.html
5、可以将以上命令放到crontab中执行,并根据需要指定更新的频率和时间:
33 6 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.test.com >/dev/null 2>&1
原文出自:marion.cublog.cn