未分類

安裝 awstats 網站資料分析 for CentOS 5

到官方網站 http://awstats.sourceforge.net/ 下載軟體

// 下載軟體
# wget http://prdownloads.sourceforge.net/awstats/awstats-6.6-1.noarch.rpm

// 安裝軟體
# rpm -ivh awstats-6.6-1.noarch.rpm
Preparing…                ########################################### [100%]
   1:awstats                ########################################### [100%]

—– AWStats 6.6 – Laurent Destailleur —–
AWStats files have been installed in /usr/local/awstats

If first install, follow instructions in documentation
(/usr/local/awstats/docs/index.html) to setup AWStats in 3 steps:
Step 1 : Install and Setup with awstats_configure.pl (or manually)
Step 2 : Build/Update Statistics with awstats.pl
Step 3 : Read Statistics

// 現在已經把套件安裝到 /usr/local/awstats/中了,awstats 有提供給 Apache 的設定檔/usr/local/awstats/tools/httpd_conf,將這個設定檔 copy 到 /etc/httpd/conf.d/ 底下,並且順便檔名改成 awstats.conf
# cp /usr/local/awstats/tools/httpd_conf /etc/httpd/conf.d/awstats.conf

// 重新啟動 Apache
# service httpd reload

// 在 /etc/awstats/ 底下有一個範列設定檔,我們多 copy 一份,再以這份來修改以下這些設定
# cd /etc/awstats/
# cp awstats.model.conf awstats.smallken.conf
# vi awstats.smallken.conf

// Apache log 檔位置
LogFile=”/var/log/httpd/access_log”

// 主機名稱,沒有 Domain Name 時設 IP 也沒問題
SiteDomain=”smallken.com”

// 執行 perl 的目錄
DirCgi=”/awstats”

// 小圖示的目錄
DirIcons=”/awstatsicons”

// 語修改系
Lang=”tw”

// 存檔離開,現在我們手動來跑一下分析網頁,執行的程式在 /usr/local/awstats/wwwroot/cgi-bin/awstats.pl
# cd /usr/local/awstats/wwwroot/cgi-bin/
# perl awstats.pl -config=smallken -update

// 去哪裡觀看分析結果網頁呢?
//
smallken 這個字串與之前那個設定檔名 awstats.smallken.conf 有關
http://IP/awstats/awstats.pl?config=smallken

// 接著我們想讓它每小時自己更新一次
// 編輯一個 script 檔 awstats.sh

# vi /usr/local/awstats/wwwroot/cgi-bin/awstats.sh
// 加入
cd /usr/local/awstats/wwwroot/cgi-bin/
perl awstats.pl -config=smallken -update

// 讓它有可執行權限
# chmod +x awstats.sh

// 加入 cron,讓它每小時都去執行 aswstats.sh 這個 script 一次
# vi /etc/crontab
01 * * * * root /usr/local/awstats/wwwroot/cgi-bin/awstats.sh

之後它每小時更新一次資料,若要查看統計網頁 http://IP/awstats/awstats.pl?config=smallken 即可!

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *