01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
cpan を RPM パッケージ管理してしまうツール。
- SourceForge.net: cpan2rpm
# rpm --import http://perl.arix.com/cpan2rpm/gpg.pub.asc「ダウンロードしたRPMパッケージの改竄チェックに使用するGPGキー」をインポート。
# wget http://downloads.sourceforge.net/cpan2rpm/cpan2rpm-2.027-1.noarch.rpm?modtime=1107798682&big_mirror=0RPM パッケージをダウンロード。
# rpm -Uvh cpan2rpm-2.027-1.noarch.rpm 準備中... ########################################### [100%] 1:cpan2rpm ########################################### [100%] # which cpan2rpm /usr/bin/cpan2rpm
Apache のログ解析ツールである AWStats をインストールしておく。
- AWStats - Free log file analyzer for advanced statistics (GNU GPL).
■ インストール
# yum --enablerepo=rpmforge list | grep -i awstats awstats.noarch 6.8-1.el5.rf rpmforge # yum --enablerepo=rpmforge install awstats Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * rpmforge: fr2.rpmfind.net * base: ftp.iij.ad.jp * updates: ftp.iij.ad.jp * addons: ftp.iij.ad.jp * extras: ftp.iij.ad.jp .... (snip) ..... Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: awstats noarch 6.8-1.el5.rf rpmforge 1.1 M Installing for dependencies: perl-Compress-Zlib i386 1.42-1.fc6 base 52 k perl-HTML-Parser i386 3.56-1.el5.rf rpmforge 146 k perl-HTML-Tagset noarch 3.20-1.el5.rf rpmforge 14 k perl-libwww-perl noarch 5.805-1.1.1 base 376 k Transaction Summary ============================================================================= Install 5 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 1.7 M Is this ok [y/N]: y Downloading Packages: (1/5): perl-HTML-Tagset-3 100% |=========================| 14 kB 00:00 (2/5): perl-Compress-Zlib 100% |=========================| 52 kB 00:00 (3/5): perl-HTML-Parser-3 100% |=========================| 146 kB 00:01 (4/5): awstats-6.8-1.el5. 100% |=========================| 1.1 MB 00:03 (5/5): perl-libwww-perl-5 100% |=========================| 376 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: perl-HTML-Tagset ######################### [1/5] Installing: perl-HTML-Parser ######################### [2/5] Installing: perl-Compress-Zlib ######################### [3/5] Installing: perl-libwww-perl ######################### [4/5] Installing: awstats ######################### [5/5] Installed: awstats.noarch 0:6.8-1.el5.rf Dependency Installed: perl-Compress-Zlib.i386 0:1.42-1.fc6 perl-HTML-Parser.i386 0:3.56-1.el5.rf perl-HTML-Tagset.noarch 0:3.20-1.el5.rf perl-libwww-perl.noarch 0:5.805-1.1.1 Complete!
# mv /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats.localhost.localdomain.conf.org # cp -p /etc/awstats/awstats.model.conf /etc/awstats/awstats.centos.jp.conf- /etc/awstats/awstats.centos.jp.conf
# diff -u awstats.model.conf awstats.centos.jp.conf --- awstats.model.conf 2008-07-26 08:44:11.000000000 +0900 +++ awstats.centos.jp.conf 2008-09-14 19:56:54.000000000 +0900 @@ -150,7 +150,8 @@ # Example: "ftp.domain.com" # Example: "domain.com" # -SiteDomain="localhost.localdomain" +#SiteDomain="localhost.localdomain" +SiteDomain="centos.jp" # Enter here all other possible domain names, addresses or virtual host @@ -185,7 +186,8 @@ # 2 - DNS Lookup is made only from static DNS cache file (if it exists) # Default: 2 # -DNSLookup=2 +#DNSLookup=2 +DNSLookup=1 # When AWStats updates its statistics, it stores results of its analysis in @@ -1315,7 +1317,7 @@ # module, so install it from elsewhere (from www.cpan.org for example). # This plugin reduces AWStats speed of 10% ! # -#LoadPlugin="geoipfree" +LoadPlugin="geoipfree" # Plugin: GeoIP_Region_Maxmind # Perl modules required: Geo::IP (from Maxmind)
# cpan2rpm --install Geo::IPfree
allow from 127.0.0.1
#!/bin/sh
logfile=`grep ^LogFile /etc/awstats/awstats.$1.conf|sed -e 's/LogFile="\([^ ]*\)"/\1/p' -e d`
for log in `ls $logfile*|sort -r`
do
`rpm -ql awstats|grep "awstats\.pl"` \
-config=$1 -update -logfile=$log
done
# ./awstatsinit.sh <サーバの FQDN>引数は、awstats の設定を見に行くために必要なもの。
/var/log/httpd/*log {
rotate 55
missingok
notifempty
sharedscripts
prerotate
`rpm -ql awstats|grep "awstats_updateall\.pl"` now -confdir="/etc/awstats" \
-awstatsprog="`rpm -ql awstats|grep "awstats\.pl"`" >/dev/null
endscript
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
./awstatsreport.sh: /usr/bin/awstats_buildstaticpages.pl: /usr/bin/perl^M: bad interpreter: そのようなファイルやディレクトリはありません ....がでてしまうので、
[root@centos ~]# vi /usr/bin/awstats_buildstaticpages.pl #!/usr/bin/perl -- <= '--'を追加を実施しておくこと。
# echo "00 00 * * * root /root/awstatsreport.sh <サーバの FQDN> /var/www/awstatsreport > /dev/null" > /etc/cron.d/awstatsreport
[2008-07-13] に書いてはいたのだが、埋もれていたので改めて。
■ rpmforge リポジトリの追加
$ wget http://dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
$ wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
vi /etc/yum.repos.d/rpmforge.repoenabled = 1 を enabled = 0 に。
# rpm --import RPM-GPG-KEY.dag.txt # yum --enablerepo=rpmforge list
2009 : 01 02 03 04 05 06 07 08 09 10 11 12
2008 : 01 02 03 04 05 06 07 08 09 10 11 12
2007 : 01 02 03 04 05 06 07 08 09 10 11 12
2006 : 01 02 03 04 05 06 07 08 09 10 11 12
2005 : 01 02 03 04 05 06 07 08 09 10 11 12
2004 : 01 02 03 04 05 06 07 08 09 10 11 12
最終更新時間: 2009-10-14 00:22