- Jcode.pm のインストール
まず、日本語版で必要とされる perl のライブラリ Jcode.pm を インストールします(インストール方法は「Jcode.pm のインストール方法メモ」参照)
- AWStats 日本語版の取得とセットアップ
AWStats 日本語版のアーカイブファイルを取得します。2008年4月21日現在、最新バージョンは 6.6 です。最新バージョンは公式ページでチェックしてください。ダウンロードが終わったら解凍します。
# wget http://www.bflets.dyndns.org/AWStats66_Jpn.tar.gz
# tar -zxvf AWStats66_Jpn.tar.gz
解凍したディレクトリは名前を変えて /usr/local 下に置きます。ここ以外に置くと AWStats が警告を発する場合があります。
# mv AWStats66_Jpn /usr/local/awstats
次に AWStats の集計データを入れるディレクトリを作成します。
# mkdir /var/lib/awstats
AWStats の CGI ディレクトリに移動します。
# cd /usr/local/awstats/wwwroot/cgi-bin
デフォルト設定ファイル awstats.model.conf を作ります。すでに日本語のデフォルト設定ファイルが別名で存在しますのでコピーして使用します。
# cp awstats.model_jp.conf awstats.model.conf
ツールディレクトリに移動し、設定スクリプトを実行します。
# cd /usr/local/awstats/tools
# ./awstats_configure.pl
すると Apache の設定ファイルのありかを聞かれます。ここで Apache の設定ファイルを答えると設定ファイルが書き換えられてしまうので「none」を入力してスキップします(Apache の設定ファイルは後ほど手動で編集します)。
-----> 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):
> none
次に設定ファイルを作るかと聞かれます。もちろん Yes です。
-----> 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:
> blog.96q.org ←ご自分が管理しているホスト名
設定ファイルのありかを聞かれます。デフォルトの /etc/awstats で良いのでそのまま Enter キーを押します。
-----> 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):
> ←何も入力せずに Enter
その後確認の意味を込めて Enter の入力を求められますので、適宜 Enter キーを押してください。
-----> 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=centos.oss.sc
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... ←何も入力せずに Enter
A SIMPLE config file has been created: /etc/awstats/awstats.centos.oss.sc.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'centos.oss.sc' with command:
> perl awstats.pl -update -config=centos.oss.sc
You can also build static report pages for 'centos.oss.sc' with command:
> perl awstats.pl -output=pagetype -config=centos.oss.sc
Press ENTER to finish... ←何も入力せずに Enter
もし、バーチャルホストとして他にも Web サイトを運営している場合は、この設定スクリプトをそのバーチャルホストぶん実行してください。
この設定スクリプトで生成した設定ファイルはそのままでは使えませんので修正します。なお、blog.96q.org という部分はご自分が管理しているホスト名に読み替えてください。
# vi /etc/awstats/awstats.blog.96q.org.conf
LogFile="/var/log/httpd/mylog.log"
↓
LogFile="/tmp/hl/blog.96q.org-log.utf8"
最後に後始末をします。
# cd
# rm -rf AWStats66_Jpn.tar.gz
以上で AWStats のセットアップは終了です。