[研究] AWStats 7.2快速安裝程式精簡版(tgz)(CentOS 6.5 x86_64)
2013-12-30
參考
http://awstats.sourceforge.net/docs/awstats_setup.html
awstats_7.2_centos6.5x64.sh 內容如下:
(下面假設網站名稱為 www,請根據自己情況修改)
echo -e "\033[31m"
echo -e "Program : awstats_7.2_centos6.5x64.sh "
echo -e "AWStats Install Shell Script (CentOS 6.5, x86_64) "
echo -e "by Shau-Rong Lu 2013/12/30 "
echo -e "\033[0m"
# Ref : http://awstats.sourceforge.net/
# http://awstats.sourceforge.net/docs/index.html
# 關閉防火牆
service iptables stop
chkconfig iptables off
# 關閉 SELinux,立刻生效 (但不保證 reboot 後)
/usr/sbin/setenforce 0
# 永久關閉 SELinux:把 /etc/selinux/config 中 SELINUX=enforcing 或 ELINUX=permissive 改為 SELINUX=disabled ( 要 reboot 後才生效)
sed -i -e "s@SELINUX=enforcing@#SELINUX=enforcing@" /etc/selinux/config
sed -i -e "s@SELINUX=permissive@#SELINUX=permissive@" /etc/selinux/config
sed -i -e "/SELINUX=/aSELINUX=disabled" /etc/selinux/config
rpm -q httpd
if [ $? != "0" ]; then
yum -y install httpd
service httpd restart
fi
if [ ! -s awstats-7.2.tar.gz ]; then
wget http://sourceforge.net/projects/awstats/files/AWStats/7.2/awstats-7.2.tar.gz/download
fi
tar zxvf awstats-7.2.tar.gz -C /usr/local
ln -s /usr/local/awstats-7.2 /usr/local/awstats
cd /usr/local/awstats/tools
perl awstats_configure.pl
#會產生 /etc/awstats/awstats.(網站名稱).conf 這個檔案
cp /etc/awstats/awstats.www.conf /etc/awstats/awstats.www.conf.bak
sed -i -e "s@mylog.log@access_log@" /etc/awstats/awstats.www.conf
sed -i -e "s@DNSLookup=2@DNSLookup=1@" /etc/awstats/awstats.www.conf
chown -R apache:apache /usr/local/awstats/
#mv /etc/cron.hourly/awstats /etc/cron.daily/
service httpd restart
mkdir /var/lib/awstats
/usr/local/awstats//wwwroot/cgi-bin/awstats.pl -update -config=www
echo '*/5 * * * * root /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www' >> /etc/crontab
service httpd restart
firefox http://localhost/awstats/awstats.pl?config=www &
其中 perl awstats_configure.pl 執行時候輸入參數請參考下面
****************************************************
引言回覆:
[root@localhost tools]# perl awstats_configure.pl
----- AWStats awstats_configure 1.0 (build 1.9) (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
Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'.
If you want to use standard directory, you should first move all content
of AWStats distribution from current directory:
/usr/local/awstats-7.2
to standard directory:
/usr/local/awstats
And then, run configure.pl from this location.
Do you want to continue setup from this NON standard directory [yN] ? y
-----> 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-7.2/wwwroot/classes/"'
Add 'Alias /awstatscss "/usr/local/awstats-7.2/wwwroot/css/"'
Add 'Alias /awstatsicons "/usr/local/awstats-7.2/wwwroot/icon/"'
Add 'ScriptAlias /awstats/ "/usr/local/awstats-7.2/wwwroot/cgi-bin/"'
Add '<Directory>' directive
AWStats directives added to Apache config file.
-----> Update model config file '/usr/local/awstats-7.2/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:
> www (請輸入網站名稱)
-----> 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):
>
-----> Create config file '/etc/awstats/awstats.www.conf'
Config file /etc/awstats/awstats.www.conf created.
-----> Restart Web server with '/sbin/service httpd restart'
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
-----> 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-7.2/wwwroot/cgi-bin/awstats.pl -update -config=www
Or if you have several config files and prefer having only one command:
/usr/local/awstats-7.2/tools/awstats_updateall.pl now
Press ENTER to continue...
A SIMPLE config file has been created: /etc/awstats/awstats.www.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www' with command:
> perl awstats.pl -update -config=www
You can also read your statistics for 'www' with URL:
> http://localhost/awstats/awstats.pl?config=www
Press ENTER to finish...
Stopping httpd: [ OK ]
Starting httpd: [Thu Dec 26 22:58:46 2013] [warn] The Alias directive in /etc/httpd/conf/httpd.conf at line 1014 will probably never match because it overlaps an earlier Alias.
[Thu Dec 26 22:58:46 2013] [warn] The Alias directive in /etc/httpd/conf/httpd.conf at line 1015 will probably never match because it overlaps an earlier Alias.
[Thu Dec 26 22:58:46 2013] [warn] The Alias directive in /etc/httpd/conf/httpd.conf at line 1016 will probably never match because it overlaps an earlier Alias.
[Thu Dec 26 22:58:46 2013] [warn] The ScriptAlias directive in /etc/httpd/conf/httpd.conf at line 1017 will probably never match because it overlaps an earlier ScriptAlias.
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[ OK ]
Create/Update database for config "/etc/awstats/awstats.www.conf" by AWStats version 7.2 (build 1.992)
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...
Jumped lines in file: 0
Parsed lines in file: 0
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.
[root@localhost ~]#
****************************************************
其中 perl awstats_configure.pl 執行時候會替 httpd.conf 增加下面內容
#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/usr/local/awstats-7.2/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats-7.2/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats-7.2/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats-7.2/wwwroot/cgi-bin/"
#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/local/awstats-7.2/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
****************************************************
(完)
參考
[研究] AWStats 7.2 安裝 (tgz)(CentOS 6.5 x86_64)
http://shaurong.blogspot.tw/2013/12/awstats-72-tgzcentos-65-x8664.html
[研究] AWStats 7.2快速安裝程式精簡版(tgz)(CentOS 6.5 x86_64)
http://shaurong.blogspot.tw/2013/12/awstats-72tgzcentos-65-x8664.html
[研究] AWStats 7.2快速安裝程式精簡版(tgz)(CentOS 5.5 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=19200
[研究] AWStats記錄檔分析 安裝法(Fedora 7)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=14960
[研究] AWStats 快速安裝程式精簡版(tgz)(CentOS 4.4, 5.1)
http://forum.icst.org.tw/phpbb/viewtopic.php?f=16&t=15013
[教學][研究] AWStats 快速安裝程式精簡版(Fedora 7,8,9)
http://forum.icst.org.tw/phpbb/viewtopic.php?f=16&t=15015
沒有留言:
張貼留言