1安装httpd服务
[root@localhost.localdomain /software]
# yum install httpd
2启动httpd(如有需要可以配置域名)
# /etc/init.d/httpd start
正在启动 httpd:
3查看80端口是否开启
# netstat -antp | grep :80
tcp 0 0 :::80 :::* LISTEN 1370/httpd
4添加httpd为开机自启动
# chkconfig httpd on
5解压awstats压缩包
unzip awstats-7.0.zip
6移动到/usr/local 下并且改名为awstats
# mv awstats-7.0 /usr/local/awstats
7找到配置文件并执行
#cd tools/
#./awstats_configure.pl
-----> 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
-----> Check and complete web server config file '/etc/httpd/conf/httpd.conf'
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
-----> 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:
> 192.168.1.128
-----> 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):
>
Press ENTER to finish...
8修改awstats配置文件
vim /etc/awstats/awstats.192.168.1.128.conf
LogFile="/var/log/httpd/access_log"
DirData="/var/lib/awstats" //看好数据的存放位置
9创建出数据的存放位置
# mkdir /var/lib/awstatsts
10更新awstats,重启htppd
./awstats_updateall.pl now
Running '"/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -update -config=192.168.1.128 -configdir="/etc/awstats"' to update config 192.168.1.128
Create/Update database for config "/etc/awstats/awstats.192.168.1.128.conf" by AWStats version 7.0 (build 1.971)
From data in log file "/var/log/httpd/access_log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 8
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 8 new qualified records.
# /etc/init.d/httpd restart
停止 httpd: [确定]
正在启动 httpd: [确定]
11测试
访问http://192.168.1.128/awstats/awstats.pl?config=192.168.1.128
如果只有一个测试域名可以只写http://192.168.1.128/awstats/awstats.pl