自宅サーバー ≫ Linux Server ≫ CentOS 7 ≫ ログ解析(AWStats)

 
AWStatsのダウンロード
 
 
[root@centos]# wget http://prdownloads.sourceforge.net/awstats/awstats-7.3-1.noarch.rpm
 
2014年10月現在の最新版は awstats-7.3-1
AWStatsのインストール
 
 
[root@centos]# rpm -ivh awstats-7.3-1.noarch.rpm
 
インストール後ダウンロードした不要なファイルを削除
 
 
[root@centos]# rm -f awstats-7.3-1.noarch.rpm
 
セットアップスクリプトの起動
 
 
[root@centos]# /usr/local/awstats/tools/awstats_configure.pl

 ----- AWStats awstats_configure 1.0 (build 20140126) (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:
 /root
 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   <--- apache の設定ファイルの場所を入力

 -----> Check and complete web server config file '/etc/httpd/conf/httpd.conf'
 Add 'Alias /awstatsclasses "/root/wwwroot/classes/"'
 Add 'Alias /awstatscss "/root/wwwroot/css/"'
 Add 'Alias /awstatsicons "/root/wwwroot/icon/"'
 Add 'ScriptAlias /awstats/ "/root/wwwroot/cgi-bin/"'
 Add '<Directory>' directive
 AWStats directives added to Apache config file.

 -----> Update model config file '/etc/awstats/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.papa-net.info   <--- ドメイン名を入力

 -----> 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

 -----> Create config file '/etc/awstats/awstats.www.papa-net.info.conf'
 Config file /etc/awstats/awstats.www.papa-net.info.conf created.

 -----> 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:
 /root/wwwroot/cgi-bin/awstats.pl -update -config=www.papa-net.info
 Or if you have several config files and prefer having only one command:
 /root/tools/awstats_updateall.pl now
 Press ENTER to continue...
   <--- 何も入力せず Enter


 A SIMPLE config file has been created: /etc/awstats/awstats.www.papa-net.info.conf
 You should have a look inside to check and change manually main parameters.
 You can then manually update your statistics for 'www.papa-net.info' with command:
 > perl awstats.pl -update -config=www.papa-net.info
 You can also read your statistics for 'www.papa-net.info' with URL:
 > http://localhost/awstats/awstats.pl?config=www.papa-net.info

 Press ENTER to finish...
   <--- 何も入力せず Enter
 
perl-CPANのインストール
 
 
[root@centos]# yum -y install perl-CPAN
 
perl-CPANの起動
 
 
[root@centos]# perl -MCPAN -e shell

 CPAN.pm requires configuration, but most of it can be done automatically.
 If you answer 'no' below, you will enter an interactive dialog for each
 configuration option instead.

 Would you like to configure as much as possible automatically? [yes]
   <--- 何も入力せず Enter

 <install_help>

 Warning: You do not have write permission for Perl library directories.

 To install modules, you need to configure a local Perl library directory or
 escalate your privileges. CPAN can help you by bootstrapping the local::lib
 module or by configuring itself to use 'sudo' (if available). You may also
 resolve this problem manually if you need to customize your setup.

 What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib]
   <--- 何も入力せず Enter

 Autoconfigured everything but 'urllist'.

 Now you need to choose your CPAN mirror sites. You can let me
 pick mirrors for you, you can select them from a list or you
 can enter them by hand.

 Would you like me to automatically choose some CPAN mirror
 sites for you? (This means connecting to the Internet) [yes
]
 Trying to fetch a mirror list from the Internet
 Fetching with LWP:
 http://www.perl.org/CPAN/MIRRORED.BY
 Fetching with LWP:
 http://www.perl.org/CPAN/MIRRORED.BY.gz
 Fetching with LWP:
 ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY

 Looking for CPAN mirrors near you (please be patient)
 ......................... done!

 New urllist
 http://mirror.rise.ph/cpan/
 http://cpan.mirror.cdnetworks.com/
 http://mirrors.shu.edu.cn/CPAN/

 Autoconfiguration complete.

 Attempting to bootstrap local::lib...

 Writing /root/.cpan/CPAN/MyConfig.pm for bootstrap...
 commit: wrote '/root/.cpan/CPAN/MyConfig.pm'
 Fetching with LWP:
 http://mirror.rise.ph/cpan/authors/01mailrc.txt.gz
 Reading '/root/.cpan/sources/authors/01mailrc.txt.gz'
 ............................................................................DONE
 Fetching with LWP:
 http://mirror.rise.ph/cpan/modules/02packages.details.txt.gz
 Reading '/root/.cpan/sources/modules/02packages.details.txt.gz'
 Database was generated on Fri, 27 Apr 2018 21:54:26 GMT
 .............
 New CPAN.pm version (v2.16) available.
 [Currently running version is v1.9800]
 You might want to try
 install CPAN
 reload cpan
 to both upgrade CPAN.pm and run the new version without leaving
 the current session.


 ...............................................................DONE
 Fetching with LWP:
 http://mirror.rise.ph/cpan/modules/03modlist.data.gz
 Reading '/root/.cpan/sources/modules/03modlist.data.gz'
 DONE
 Writing /root/.cpan/Metadata
 Running make for H/HA/HAARG/local-lib-2.000024.tar.gz
 Fetching with LWP:
 http://mirror.rise.ph/cpan/authors/id/H/HA/HAARG/local-lib-2.000024.tar.gz
 Fetching with LWP:
 http://mirror.rise.ph/cpan/authors/id/H/HA/HAARG/CHECKSUMS
 Checksum for /root/.cpan/sources/authors/id/H/HA/HAARG/local-lib-2.000024.tar.gz ok

 CPAN.pm: Building H/HA/HAARG/local-lib-2.000024.tar.gz

 Attempting to create directory /root/perl5

 Dispatching deprecated method 'CPAN::Config::load' to CPAN::HandleConfig

 Dispatching deprecated method 'CPAN::Config::load' to CPAN::HandleConfig
 Reading '/root/.cpan/Metadata'
 Database was generated on Fri, 27 Apr 2018 21:54:26 GMT
 Running install for module 'ExtUtils::MakeMaker'
 Running make for B/BI/BINGOS/ExtUtils-MakeMaker-7.34.tar.gz
 Fetching with LWP:
 http://mirror.rise.ph/cpan/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.34.tar.gz
 Fetching with LWP:
 http://mirror.rise.ph/cpan/authors/id/B/BI/BINGOS/CHECKSUMS
 Checksum for /root/.cpan/sources/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.34.tar.gz ok

 CPAN.pm: Building B/BI/BINGOS/ExtUtils-MakeMaker-7.34.tar.gz

 Using included version of CPAN::Meta (2.143240) as it is newer than the installed version (2.120921).
 Using included version of Parse::CPAN::Meta (1.4414) as it is newer than the installed version 
 (1.4404).
 Using included version of CPAN::Meta::YAML (0.011) as it is newer than the installed version (0.008).
 Using included version of ExtUtils::Manifest (1.70) as it is newer than the installed version (1.61).
 Using included version of JSON::PP (2.27203) as it is newer than the installed version (2.27202).
 Using included version of ExtUtils::Install (2.06) as it is newer than the installed version (1.58).
 Using included version of CPAN::Meta::Requirements (2.131) as it is newer than the installed version
 (2.122).
 Checking if your kit is complete...
 Looks good
 Generating a Unix-style Makefile
 Writing Makefile for ExtUtils::MakeMaker
 Writing MYMETA.yml and MYMETA.json
 cp inc/ExtUtils/Manifest.pm blib/lib/ExtUtils/Manifest.pm
 cp lib/ExtUtils/MM_VOS.pm blib/lib/ExtUtils/MM_VOS.pm
 cp lib/ExtUtils/MM.pm blib/lib/ExtUtils/MM.pm
 cp inc/JSON/PP.pm blib/lib/JSON/PP.pm
 cp lib/ExtUtils/MM_UWIN.pm blib/lib/ExtUtils/MM_UWIN.pm
 cp lib/ExtUtils/MM_DOS.pm blib/lib/ExtUtils/MM_DOS.pm
 cp lib/ExtUtils/MM_Cygwin.pm blib/lib/ExtUtils/MM_Cygwin.pm
 cp lib/ExtUtils/MM_Win95.pm blib/lib/ExtUtils/MM_Win95.pm
 cp lib/ExtUtils/Liblist.pm blib/lib/ExtUtils/Liblist.pm
 cp lib/ExtUtils/MM_Darwin.pm blib/lib/ExtUtils/MM_Darwin.pm
 cp lib/ExtUtils/MM_AIX.pm blib/lib/ExtUtils/MM_AIX.pm
 cp inc/CPAN/Meta/Requirements.pm blib/lib/CPAN/Meta/Requirements.pm
 cp lib/ExtUtils/Liblist/Kid.pm blib/lib/ExtUtils/Liblist/Kid.pm
 cp lib/ExtUtils/MakeMaker/FAQ.pod blib/lib/ExtUtils/MakeMaker/FAQ.pod
 cp inc/ExtUtils/MANIFEST.SKIP blib/lib/ExtUtils/MANIFEST.SKIP
 cp lib/ExtUtils/MM_NW5.pm blib/lib/ExtUtils/MM_NW5.pm
 cp lib/ExtUtils/MakeMaker.pm blib/lib/ExtUtils/MakeMaker.pm
 cp lib/ExtUtils/MM_OS2.pm blib/lib/ExtUtils/MM_OS2.pm
 cp inc/CPAN/Meta/Feature.pm blib/lib/CPAN/Meta/Feature.pm
 cp lib/ExtUtils/Command.pm blib/lib/ExtUtils/Command.pm
 cp lib/ExtUtils/MM_Unix.pm blib/lib/ExtUtils/MM_Unix.pm
 cp lib/ExtUtils/MM_Win32.pm blib/lib/ExtUtils/MM_Win32.pm
 cp inc/ExtUtils/Installed.pm blib/lib/ExtUtils/Installed.pm
 cp inc/JSON/PP/Boolean.pm blib/lib/JSON/PP/Boolean.pm
 cp inc/CPAN/Meta/Spec.pm blib/lib/CPAN/Meta/Spec.pm
 cp inc/CPAN/Meta/History.pm blib/lib/CPAN/Meta/History.pm
 cp lib/ExtUtils/MY.pm blib/lib/ExtUtils/MY.pm
 cp inc/ExtUtils/Packlist.pm blib/lib/ExtUtils/Packlist.pm
 cp lib/ExtUtils/MM_MacOS.pm blib/lib/ExtUtils/MM_MacOS.pm
 cp lib/ExtUtils/MM_VMS.pm blib/lib/ExtUtils/MM_VMS.pm
 cp inc/CPAN/Meta/Merge.pm blib/lib/CPAN/Meta/Merge.pm
 cp lib/ExtUtils/MM_BeOS.pm blib/lib/ExtUtils/MM_BeOS.pm
 cp lib/ExtUtils/MM_QNX.pm blib/lib/ExtUtils/MM_QNX.pm
 cp inc/CPAN/Meta/YAML.pm blib/lib/CPAN/Meta/YAML.pm
 cp inc/CPAN/Meta/Converter.pm blib/lib/CPAN/Meta/Converter.pm
 cp inc/ExtUtils/Install.pm blib/lib/ExtUtils/Install.pm
 cp lib/ExtUtils/Command/MM.pm blib/lib/ExtUtils/Command/MM.pm
 cp lib/ExtUtils/MakeMaker/Config.pm blib/lib/ExtUtils/MakeMaker/Config.pm
 cp inc/CPAN/Meta.pm blib/lib/CPAN/Meta.pm
 cp inc/CPAN/Meta/Prereqs.pm blib/lib/CPAN/Meta/Prereqs.pm
 cp inc/Parse/CPAN/Meta.pm blib/lib/Parse/CPAN/Meta.pm
 cp inc/CPAN/Meta/Validator.pm blib/lib/CPAN/Meta/Validator.pm
 cp lib/ExtUtils/MM_Any.pm blib/lib/ExtUtils/MM_Any.pm
 cp lib/ExtUtils/MakeMaker/Tutorial.pod blib/lib/ExtUtils/MakeMaker/Tutorial.pod
 cp lib/ExtUtils/Mkbootstrap.pm blib/lib/ExtUtils/Mkbootstrap.pm
 cp lib/ExtUtils/Mksymlists.pm blib/lib/ExtUtils/Mksymlists.pm
 cp lib/ExtUtils/MakeMaker/version/regex.pm blib/lib/ExtUtils/MakeMaker/version/regex.pm
 cp lib/ExtUtils/testlib.pm blib/lib/ExtUtils/testlib.pm
 cp lib/ExtUtils/MakeMaker/Locale.pm blib/lib/ExtUtils/MakeMaker/Locale.pm
 cp lib/ExtUtils/MakeMaker/version.pm blib/lib/ExtUtils/MakeMaker/version.pm
 cp lib/ExtUtils/MakeMaker/version/vpp.pm blib/lib/ExtUtils/MakeMaker/version/vpp.pm
 cp bin/instmodsh blib/script/instmodsh
 "/usr/bin/perl" "-Iblib/arch" "-Iblib/lib" -MExtUtils::MY -e 'MY->fixin(shift)' --
 blib/script/instmodsh
 Manifying 1 pod document
 Manifying 38 pod documents
 Manifying 8 pod documents
 BINGOS/ExtUtils-MakeMaker-7.34.tar.gz
 /usr/bin/make -- OK
 'YAML' not installed, will not store persistent state
 Running make test
 PERL_DL_NONLAZY=1 "/usr/bin/perl" "-Iblib/arch" "-Iblib/lib" "-MExtUtils::Command::MM" "-
 MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
 t/00compile.t ............. ok
 t/01perl_bugs.t ........... ok
 t/02-xsdynamic.t .......... ok
 t/03-xsstatic.t ........... skipped: Shared perl library
 t/arch_check.t ............ ok
 t/backwards.t ............. ok
 t/basic.t ................. ok
 t/build_man.t ............. 1/10 WARNING: Older versions of ExtUtils::MakeMaker may errantly install
 README.pod as part of this distribution. It is recommended to avoid using this path in CPAN modules.
 WARNING: Older versions of ExtUtils::MakeMaker may errantly install README.pod as part of this
 distribution. It is recommended to avoid using this path in CPAN modules.
 WARNING: Older versions of ExtUtils::MakeMaker may errantly install README.pod as part of this
 distribution. It is recommended to avoid using this path in CPAN modules.
 WARNING: Older versions of ExtUtils::MakeMaker may errantly install README.pod as part of this
 distribution. It is recommended to avoid using this path in CPAN modules.
 t/build_man.t ............. ok
 t/cd.t .................... ok
 t/config.t ................ ok
 t/cp.t .................... ok
 t/dir_target.t ............ ok
 t/echo.t .................. ok
 t/eu_command.t ............ ok
 t/FIRST_MAKEFILE.t ........ ok
 t/fix_libs.t .............. ok
 t/fixin.t ................. ok
 t/hints.t ................. ok
 t/INST.t .................. ok
 t/INST_PREFIX.t ........... ok
 t/INSTALL_BASE.t .......... ok
 t/installed_file.t ........ ok
 t/is_of_type.t ............ ok
 t/Liblist.t ............... ok
 t/Liblist_Kid.t ........... ok
 t/make.t .................. ok
 t/MakeMaker_Parameters.t .. ok
 t/maketext_filter.t ....... ok
 t/meta_convert.t .......... ok
 t/metafile_data.t ......... ok
 t/metafile_file.t ......... ok
 t/min_perl_version.t ...... ok
 t/miniperl.t .............. skipped: miniperl test only necessary for the perl core
 t/Mkbootstrap.t ........... ok
 t/MM_Any.t ................ ok
 t/MM_BeOS.t ............... skipped: This is not BeOS
 t/MM_Cygwin.t ............. skipped: This is not cygwin
 t/MM_NW5.t ................ skipped: This is not NW5
 t/MM_OS2.t ................ skipped: This is not OS/2
 t/MM_Unix.t ............... 1/113 WARNING: Older versions of ExtUtils::MakeMaker may errantly install
 Readme.pod as part of this distribution. It is recommended to avoid using this path in CPAN modules.
 WARNING: Older versions of ExtUtils::MakeMaker may errantly install README.pod as part of this
 distribution. It is recommended to avoid using this path in CPAN modules.
 t/MM_Unix.t ............... ok
 t/MM_VMS.t ................ skipped: This is not VMS
 t/MM_Win32.t .............. skipped: This is not Win32
 t/oneliner.t .............. ok
 t/os_unsupported.t ........ ok
 t/parse_abstract.t ........ ok
 t/parse_version.t ......... ok
 t/PL_FILES.t .............. ok
 t/pm.t .................... ok
 t/pm_to_blib.t ............ ok
 t/pod2man.t ............... ok
 t/postamble.t ............. ok
 t/prefixify.t ............. ok
 t/prereq.t ................ ok
 t/prereq_print.t .......... ok
 t/problems.t .............. ok
 t/prompt.t ................ ok
 t/recurs.t ................ ok
 t/revision.t .............. ok
 t/several_authors.t ....... ok
 t/split_command.t ......... ok
 t/test_boilerplate.t ...... ok
 t/testlib.t ............... ok
 t/unicode.t ............... ok
 t/VERSION_FROM.t .......... ok
 t/vstrings.t .............. ok
 t/WriteEmptyMakefile.t .... ok
 t/writemakefile_args.t .... ok
 All tests successful.
 Files=67, Tests=1335, 36 wallclock secs ( 0.26 usr 0.05 sys + 22.42 cusr 4.45 csys = 27.18 CPU)
 Result: PASS
 BINGOS/ExtUtils-MakeMaker-7.34.tar.gz
 /usr/bin/make test -- OK
 Running make install
 Manifying 1 pod document
 Manifying 38 pod documents
 Manifying 8 pod documents
 Installing /root/perl5/lib/perl5/ExtUtils/Manifest.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_VOS.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_UWIN.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_DOS.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_Cygwin.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_Win95.pm
 Installing /root/perl5/lib/perl5/ExtUtils/Liblist.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_Darwin.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_AIX.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MANIFEST.SKIP
 Installing /root/perl5/lib/perl5/ExtUtils/MM_NW5.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MakeMaker.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_OS2.pm
 Installing /root/perl5/lib/perl5/ExtUtils/Command.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_Unix.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_Win32.pm
 Installing /root/perl5/lib/perl5/ExtUtils/Installed.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MY.pm
 Installing /root/perl5/lib/perl5/ExtUtils/Packlist.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_MacOS.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_VMS.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_BeOS.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_QNX.pm
 Installing /root/perl5/lib/perl5/ExtUtils/Install.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MM_Any.pm
 Installing /root/perl5/lib/perl5/ExtUtils/Mkbootstrap.pm
 Installing /root/perl5/lib/perl5/ExtUtils/Mksymlists.pm
 Installing /root/perl5/lib/perl5/ExtUtils/testlib.pm
 Installing /root/perl5/lib/perl5/ExtUtils/Liblist/Kid.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MakeMaker/FAQ.pod
 Installing /root/perl5/lib/perl5/ExtUtils/MakeMaker/Config.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MakeMaker/Tutorial.pod
 Installing /root/perl5/lib/perl5/ExtUtils/MakeMaker/Locale.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MakeMaker/version.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MakeMaker/version/regex.pm
 Installing /root/perl5/lib/perl5/ExtUtils/MakeMaker/version/vpp.pm
 Installing /root/perl5/lib/perl5/ExtUtils/Command/MM.pm
 Installing /root/perl5/lib/perl5/JSON/PP.pm
 Installing /root/perl5/lib/perl5/JSON/PP/Boolean.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta/Requirements.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta/Feature.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta/Spec.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta/History.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta/Merge.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta/YAML.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta/Converter.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta/Prereqs.pm
 Installing /root/perl5/lib/perl5/CPAN/Meta/Validator.pm
 Installing /root/perl5/lib/perl5/Parse/CPAN/Meta.pm
 Installing /root/perl5/man/man1/instmodsh.1
 Installing /root/perl5/man/man3/CPAN::Meta.3pm
 Installing /root/perl5/man/man3/CPAN::Meta::Converter.3pm
 Installing /root/perl5/man/man3/CPAN::Meta::Feature.3pm
 Installing /root/perl5/man/man3/CPAN::Meta::History.3pm
 Installing /root/perl5/man/man3/CPAN::Meta::Merge.3pm
 Installing /root/perl5/man/man3/CPAN::Meta::Prereqs.3pm
 Installing /root/perl5/man/man3/CPAN::Meta::Requirements.3pm
 Installing /root/perl5/man/man3/CPAN::Meta::Spec.3pm
 Installing /root/perl5/man/man3/CPAN::Meta::Validator.3pm
 Installing /root/perl5/man/man3/CPAN::Meta::YAML.3pm
 Installing /root/perl5/man/man3/ExtUtils::Install.3pm
 Installing /root/perl5/man/man3/ExtUtils::Installed.3pm
 Installing /root/perl5/man/man3/ExtUtils::Manifest.3pm
 Installing /root/perl5/man/man3/ExtUtils::Packlist.3pm
 Installing /root/perl5/man/man3/JSON::PP.3pm
 Installing /root/perl5/man/man3/JSON::PP::Boolean.3pm
 Installing /root/perl5/man/man3/Parse::CPAN::Meta.3pm
 Installing /root/perl5/man/man3/ExtUtils::Command.3pm
 Installing /root/perl5/man/man3/ExtUtils::Command::MM.3pm
 Installing /root/perl5/man/man3/ExtUtils::Liblist.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_AIX.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_Any.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_BeOS.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_Cygwin.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_DOS.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_Darwin.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_MacOS.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_NW5.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_OS2.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_QNX.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_UWIN.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_Unix.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_VMS.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_VOS.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_Win32.3pm
 Installing /root/perl5/man/man3/ExtUtils::MM_Win95.3pm
 Installing /root/perl5/man/man3/ExtUtils::MY.3pm
 Installing /root/perl5/man/man3/ExtUtils::MakeMaker.3pm
 Installing /root/perl5/man/man3/ExtUtils::MakeMaker::Config.3pm
 Installing /root/perl5/man/man3/ExtUtils::MakeMaker::FAQ.3pm
 Installing /root/perl5/man/man3/ExtUtils::MakeMaker::Locale.3pm
 Installing /root/perl5/man/man3/ExtUtils::MakeMaker::Tutorial.3pm
 Installing /root/perl5/man/man3/ExtUtils::Mkbootstrap.3pm
 Installing /root/perl5/man/man3/ExtUtils::Mksymlists.3pm
 Installing /root/perl5/man/man3/ExtUtils::testlib.3pm
 Installing /root/perl5/bin/instmodsh
 Appending installation info to /root/perl5/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
 BINGOS/ExtUtils-MakeMaker-7.34.tar.gz
 /usr/bin/make install -- OK

 Checking if your kit is complete...
 Looks good
 Generating a Unix-style Makefile
 Writing Makefile for local::lib
 Writing MYMETA.yml and MYMETA.json
 cp lib/POD2/PT_BR/local/lib.pod blib/lib/POD2/PT_BR/local/lib.pod
 cp lib/lib/core/only.pm blib/lib/lib/core/only.pm
 cp lib/local/lib.pm blib/lib/local/lib.pm
 cp lib/POD2/DE/local/lib.pod blib/lib/POD2/DE/local/lib.pod
 Manifying 4 pod documents
 HAARG/local-lib-2.000024.tar.gz
 /usr/bin/make -- OK
 'YAML' not installed, will not store persistent state
 Running make test
 PERL_DL_NONLAZY=1 "/usr/bin/perl" "-I/root/perl5/lib/perl5" "-MExtUtils::Command::MM" "-MTest::Harness"
 "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
 t/bad_variables.t ...... ok
 t/carp-mismatch.t ...... ok
 t/classmethod.t ........ ok
 t/de-dup.t ............. ok
 t/lib-core-only.t ...... ok
 t/pipeline.t ........... ok
 t/shell.t .............. ok
 t/stackable.t .......... ok
 t/subroutine-in-inc.t .. ok
 t/taint-mode.t ......... ok
 All tests successful.
 Files=10, Tests=172, 1 wallclock secs ( 0.04 usr 0.01 sys + 0.73 cusr 0.30 csys = 1.08 CPU)
 Result: PASS
 HAARG/local-lib-2.000024.tar.gz
 /usr/bin/make test -- OK
 Running make install
 Manifying 4 pod documents
 Installing /root/perl5/lib/perl5/local/lib.pm
 Installing /root/perl5/lib/perl5/POD2/PT_BR/local/lib.pod
 Installing /root/perl5/lib/perl5/POD2/DE/local/lib.pod
 Installing /root/perl5/lib/perl5/lib/core/only.pm
 Installing /root/perl5/man/man3/POD2::DE::local::lib.3pm
 Installing /root/perl5/man/man3/POD2::PT_BR::local::lib.3pm
 Installing /root/perl5/man/man3/lib::core::only.3pm
 Installing /root/perl5/man/man3/local::lib.3pm
 Appending installation info to /root/perl5/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
 HAARG/local-lib-2.000024.tar.gz
 /usr/bin/make install -- OK

 local::lib is installed. You must now add the following environment variables
 to your shell configuration files (or registry, if you are on Windows) and
 then restart your command line shell and CPAN before installing modules:

 PATH="/root/perl5/bin${PATH:+:${PATH}}"; export PATH;
 PERL5LIB="/root/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
 PERL_LOCAL_LIB_ROOT="/root/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export 
 PERL_LOCAL_LIB_ROOT;
 PERL_MB_OPT="--install_base \"/root/perl5\""; export PERL_MB_OPT;
 PERL_MM_OPT="INSTALL_BASE=/root/perl5"; export PERL_MM_OPT;

 Would you like me to append that to /root/.bashrc now? [yes]
   <--- 何も入力せず Enter

 
commit: wrote '/root/.cpan/CPAN/MyConfig.pm'

 You can re-run configuration any time with 'o conf init' in the CPAN shell
 Terminal does not support AddHistory.

 cpan shell -- CPAN exploration and modules installation (v1.9800)
 Enter 'h' for help.

 cpan[1]>
install Geo::IPfree   <--- 入力(Geo::IPfreeのインストール)
 Running install for module 'Geo::IPfree'
 Running make for B/BR/BRICAS/Geo-IPfree-1.151940.tar.gz
 Fetching with LWP:
 http://mirror.rise.ph/cpan/authors/id/B/BR/BRICAS/Geo-IPfree-1.151940.tar.gz
 Fetching with LWP:
 http://mirror.rise.ph/cpan/authors/id/B/BR/BRICAS/CHECKSUMS
 Checksum for /root/.cpan/sources/authors/id/B/BR/BRICAS/Geo-IPfree-1.151940.tar.gz ok

 CPAN.pm: Building B/BR/BRICAS/Geo-IPfree-1.151940.tar.gz

 Checking if your kit is complete...
 Looks good
 Generating a Unix-style Makefile
 Writing Makefile for Geo::IPfree
 Writing MYMETA.yml and MYMETA.json
 cp lib/Geo/ipscountry.dat blib/lib/Geo/ipscountry.dat
 cp lib/Geo/IPfree.pm blib/lib/Geo/IPfree.pm
 Manifying 1 pod document
 BRICAS/Geo-IPfree-1.151940.tar.gz
 /usr/bin/make -- OK
 Running make test
 PERL_DL_NONLAZY=1 "/ sr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef
 *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
 t/base.t .......... ok
 t/basic-faster.t .. ok
 t/basic-obj.t ..... ok
 t/basic.t ......... ok
 t/ip-nb.t ......... ok
 t/pod.t ........... skipped: Test::Pod 1.00 required for testing POD
 t/pod_coverage.t .. skipped: Test::Pod::Coverage 1.00 required for testing POD coverage
 t/use.t ........... ok
 All tests successful.
 Files=8, Tests=212, 1 wallclock secs ( 0.03 usr 0.01 sys + 0.39 cusr 0.02 csys = 0.45 CPU)
 Result: PASS
 BRICAS/Geo-IPfree-1.151940.tar.gz
 /usr/bin/make test -- OK
 Running make install
 Manifying 1 pod document
 Installing /root/perl5/lib/perl5/Geo/ipscountry.dat
 Installing /root/perl5/lib/perl5/Geo/IPfree.pm
 Installing /root/perl5/man/man3/Geo::IPfree.3pm
 Appending installation info to /root/perl5/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
 BRICAS/Geo-IPfree-1.151940.tar.gz
 /usr/bin/make install -- OK

 cpan[2]>
quit   <--- 入力(終了)
 Terminal does not support GetHistory.
 Lockfile removed.

 *** Remember to restart your shell before running cpan again ***
 
AWStatsの設定
 
 
[root@centos]# vi /etc/awstats/awstats.www.papa-net.info.conf
 

 
途中略

 #-----------------------------------------------------------------------------
 # MAIN SETUP SECTION (Required to make AWStats work)
 #-----------------------------------------------------------------------------

 

 
途中略
 
 LogFile="/var/log/httpd/mylog.log"
   <--- 書き換え(アクセスログの場所)
   ↓
 LogFile="/var/log/httpd/access_log"

 
途中略
 
 DNSLookup=
2   <--- 書き換え(ドメイン名取得)
   ↓
 DNSLookup=1
 
 # When AWStats updates its statistics, it stores results of its analysis in
 # files (AWStats database). All those files are written in the directory
 # defined by the "DirData" parameter. Set this value to the directory where
 # you want AWStats to save its database and working files into.
 # Warning: If you want to be able to use the "AllowToUpdateStatsFromBrowser"
 # feature (see later), you need "Write" permissions by web server user on this
 # directory (and "Modify" for Windows NTFS file systems).
 # Example: "/var/lib/awstats"
 # Example: "../data"
 # Example: "C:/awstats_data_dir"
 # Default: "." (means same directory as awstats.pl)
 DirData="
/var/lib/awstats"   <--- 書き換え(データの保存場所をデフォルトにする)
   ↓
 DirData="
."
 
 
途中略
 
 #-----------------------------------------------------------------------------
 # OPTIONAL SETUP SECTION (Not required but increase AWStats features)
 #-----------------------------------------------------------------------------
 
 
途中略
 
 SkipHosts=""
   <--- 書き換え(ローカルLAN内だけにアクセス許可)
   ↓
 SkipHosts="127.0.0.1 REGEX[^192\.168\.1\.]"

 
途中略
 
 #-----------------------------------------------------------------------------
 # OPTIONAL ACCURACY SETUP SECTION (Not required but increase AWStats features)
 #-----------------------------------------------------------------------------

 
途中略

 LevelForWormsDetection=0               # 0 disables Worms detection.  <--- 書き換え(Worm も対象)
   ↓
 LevelForWormsDetection=
2

 
途中略
 
 #-----------------------------------------------------------------------------
 # OPTIONAL APPEARANCE SETUP SECTION (Not required but increase AWStats features)
 #-----------------------------------------------------------------------------

 
途中略

 Lang="
auto"   <--- 書き換え(日本語にする)
   ↓
 Lang="jp"
 
 
途中略

 FirstDayOfWeek=
1   <--- 書き換え(週の始まりを日曜日にする)
   ↓
 FirstDayOfWeek=0

 
以下略
 
awstats 用 apache の設定
 
 
[root@centos]# vi /etc/httpd/conf/httpd.conf
 
 
途中略

 #
 # Directives to allow use of AWStats as a CGI
 #
 Alias /awstatsclasses "/root/wwwroot/classes/"
   <--- 以下4行書き換え
 Alias /awstatscss "/root/wwwroot/css/"
 Alias /awstatsicons "/root/wwwroot/icon/"
 ScriptAlias /awstats/ "/root/wwwroot/cgi-bin/"
   ↓
 Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
 Alias /awstatscss "
/usr/local/awstats/wwwroot/css/"
 Alias /awstatsicons "
/usr/local/awstats/wwwroot/icon/"
 ScriptAlias /awstats/ "
/usr/local/awstats/wwwroot/cgi-bin/"

 #
 # This is to permit URL access to scripts/files in AWStats directory.
 #
 <Directory "
/root/wwwroot">   <--- 書き換え
   ↓
 <Directory "/usr/local/awstats/wwwroot">
     Options None
     AllowOverride None
     Order allow,deny
     Allow from all
 </Directory>

 
 
途中略
 
Apache の再起動
 
 [root@
centos]# systemctl restart httpd
 
ログ収集用スクリプトの作成
 
 
[root@centos]# vi /usr/share/awstats/wwwroot/cgi-bin/awstats.sh
 
 以下新規記述 
 

 
#!/bin/bash
 /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.papa-net.info

 
アクセス権の変更
 
 [root@
centos]# chmod 700 /usr/share/awstats/wwwroot/cgi-bin/awstats.sh
 
上記スクリプトの実行
 
 
[root@centos]# /usr/share/awstats/wwwroot/cgi-bin/awstats.sh
 Create/Update database for config "/etc/awstats/awstats.www.papa-net.info.conf" by AWStats version 7.3 (build 20140126)
 From data in log file "/var/log/httpd/access_log"...
 Phase 1 : First bypass old records, searching new record...
 Direct access after last parsed record (after line 2205)
 Jumped lines in file: 2205
 Found 2205 already parsed records.
 Parsed lines in file: 680
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 680 new qualified records.

 
アクセス権の変更
 
 [root@
centos]# chown -R apache.apache /usr/share/awstats/
 
 
 [root@
centos]# chmod 775 /usr/share/awstats/
 
 
 [root@
centos]# chmod 755 /usr/share/awstats/wwwroot/cgi-bin/awstats.pl
 
Webサーバー(apache)用設定ファイルの作成
 
 
[root@centos]# vi /etc/awstats/awstats.apache.conf
 以下新規記述
 
LogFile="/var/log/httpd/access_log"
 LogType=W
 LogFormat=1
 SiteDomain="www.papa-net.info"
   <--- ドメイン名の指定
 HostAliases="REGEX[^.*\.papa-net\.(net|com)$]"
   <--- ドメイン名の真ん中 ****** を指定
 DNSLookup=1
 DirData="/usr/share/awstats"
 DirCgi="/usr/share/awstats/wwwroot/cgi-bin"
 DirIcons="/usr/share/awstats/wwwroot/icon"
 EnableLockForUpdate=1
 SkipDNSLookupFor="REGEX[^192\.168\.1\.]"
   <--- DNSの逆引きを行わないIPアドレス指定
 AllowAccessFromWebToFollowingIPAddresses="192.168.1.1-192.168.1.254"
   <--- ログ解析を閲覧できる
 SkipHosts="127.0.0.1 REGEX[^192\.168\.1\.]"                      
範囲の指定
 Lang="jp"

 
尚、外部よりアクセスログ解析を閲覧したい場合は下から3行目の

AllowAccessFromWebToFollowingIPAddresses="192.168.1.1-192.168.1.254

を記述しない

Apache の実行権限
Webサーバーの設定でCGIスプリクトの実行権限が無いと正常に表示されない
 
 [root@
centos]# vi /etc/httpd/conf/httpd.conf
 
 
途中略
 

 # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
 # CGI directory exists, if you have that configured.
 #
 <Directory "/var/www/cgi-bin">
     AllowOverride None
     Options None
     Options Includes ExecCGI FollowSymLinks
     Require all granted
 </Directory>

 
以下追記
 
<Directory "/usr/share/awstats/wwwroot/cgi-bin"> 
     AllowOverride None
     Options Includes ExecCGI FollowSymLinks
     Require all granted
 </Directory>

 

 
以下略
 
Apache の設定ファイルを開きCGIスプリクトの実行権限を追加、その後 Apache を再起動
 
 [root@
centos]# systemctl restart httpd
 
Webサーバー(apache)用ログ解析出力用HTMLファイルの作成
 
 [root@
centos]# /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=apache
 Create/Update database for config "/etc/awstats/awstats.apache.conf" by AWStats version 7.3 (build
  20140126)
 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: 2885
  Found 445 dropped records,
  Found 0 comments,
  Found 0 blank records,
  Found 29 corrupted records,
  Found 0 old records,
  Found 2411 new qualified records.

 
Webサーバー(apache)用解析結果のブラウザ表示
http://サーバーのIPアドレス(ドメイン名)/awstats/awstats.pl?config=apache にアクセスすると下図のように解析結果が表示

メールサーバー(Postfix)用設定ファイルの作成
 
 
[root@centos]# vi /etc/awstats/awstats.mail.conf
 
以下新規記述
 
LogFile="perl /usr/share/awstats/tools/maillogconvert.pl standard < /var/log/maillog |"
 LogType=M
 LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"
 SiteDomain="www.******.com"
   <--- ドメイン名の指定
 DNSLookup=2
 DirData="/usr/share/awstats"
 DirCgi="/usr/share/awstats/wwwroot/sgi-bin"
 DirIcons="/usr/share/awstats/wwwroot/icon"
 EnableLockForUpdate=1
 AllowAccessFromWebToFollowingIPAddresses="192.168.1.1-192.168.1.254"
   <--- ログ解析を閲覧できる
 SkipHosts="127.0.0.1 REGEX[^192\.168\.1\.]"                       
範囲の指定
 Lang="jp"

 LevelForBrowsersDetection=0
 LevelForOSDetection=0
 LevelForRefererAnalyze=0
 LevelForRobotsDetection=0
 LevelForSearchEnginesDetection=0
 LevelForKeywordsDetection=0
 LevelForFileTypesDetection=0
 LevelForWormsDetection=0

 ShowMonthStats=UHB
 ShowDaysOfMonthStats=HB
 ShowDaysOfWeekStats=HB
 ShowHoursStats=HB
 ShowDomainsStats=0
 ShowHostsStats=HBL
 ShowRobotsStats=0
 ShowEMailSenders=HBML
 ShowEMailReceivers=HBML
 ShowSessionsStats=0
 ShowPagesStats=0
 ShowFileTypesStats=0
 ShowFileSizesStats=0
 ShowOSStats=0
 ShowBrowsersStats=0
 ShowOriginStats=0
 ShowKeyphrasesStats=0
 ShowKeywordsStats=0
 ShowMiscStats=0
 ShowHTTPErrorsStats=0
 ShowSMTPErrorsStats=1

 
尚、外部よりアクセスログ解析を閲覧したい場合は上から10行目の

AllowAccessFromWebToFollowingIPAddresses="192.168.0.1-192.168.0.254

を記述しない

ログ収集用スクリプトの作成
 
 
[root@centos]# vi /usr/share/awstats/wwwroot/cgi-bin/awstatsinit.sh
 
以下新規記述
 
#!/bin/sh
 tmplog1=`mktemp`
 tmplog2=`mktemp`
 for log in `ls /var/log/maillog*|sort -r`
 do
   cat $log >> $tmplog1
 done
 /usr/share/awstats/tools/maillogconvert.pl standard < $tmplog1 > $tmplog2
 /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=mail -update -logfile=$tmplog2
 rm -f $tmplog1 $tmplog2

 
アクセス権の変更
 
 [root@
centos]# chmod 755 /usr/share/awstats/wwwroot/cgi-bin/awstatsinit.sh
 
メールサーバー(Postfix)用ログ解析出力用HTMLファイルの作成
 
 [root@
centos]# /usr/share/awstats/wwwroot/cgi-bin/awstatsinit.sh
 Create/Update database for config "/etc/awstats/awstats.mail.conf" by AWStats version 7.3 (build
  20140126)
 From data in log file "/tmp/tmp.wqfm8aqDfs"...
 Warning: HostAliases parameter is not defined, awstats choose "www.papa-net.info localhost 127.0.0.1".
 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: 61
  Found 0 dropped records,
  Found 0 comments,
  Found 0 blank records,
  Found 47 corrupted records,
  Found 0 old records,
  Found 14 new qualified records.

 
メールサーバー(Postfix)用解析結果のブラウザ表示
http://サーバーのIPアドレス(ドメイン名)/awstats/awstats.pl?config=mail にアクセス すると下図のように解析結果が表示

戻る