Ⅳ.Fedora18サーバー構築記録_MT5.2のセットアップ_Perlモジュール

ここからはMT5.2の導入について記載していきます。ソースビルドより早いので原則yumインストールにより作業しましたが、これが一筋縄では行きませんでした。途中エラーを調べながら、cpanmコマンドとCPANシェルによるインストールとを併用しました。それでも、依存性を確認しながら自分で1つづつビルドしなくてい良い分本当に便利になりました。

8.Perlモジュールの導入

(1)サムネールで必要なモジュールと基本機能で必要なモジュール
http://www.movabletype.jp/documentation/mt5/installation/system.html

***************
# yum install ImageMagick-perl
==============================================================
インストール中:
ImageMagick-perl i686 6.7.7.5-3.fc18 fedora 140 k
依存性関連でのインストールをします:
ImageMagick i686 6.7.7.5-3.fc18 fedora 2.0 M
libwmf-lite i686 0.2.8.4-33.fc18 fedora 65 k
................
● 完了しました!

***************
# yum -y install perl-GD
読み込んだプラグイン:langpacks, presto, refresh-packagekit
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ perl-GD.i686 0:2.44-12.fc18 は インストール です
--> 依存性解決を終了しました。

依存性を解決しました

==============================================================
Package アーキテクチャ バージョン リポジトリー 容量
==============================================================
インストール中:
perl-GD i686 2.44-12.fc18 fedora 171 k

トランザクションの要約
==============================================================
インストール 1 パッケージ
・・・・・・・・・・・・・・・・
● 完了しました!

***************
# yum -y install perl-CGI
読み込んだプラグイン:langpacks, presto, refresh-packagekit
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ perl-CGI.noarch 0:3.59-235.fc18 は インストール です
--> 依存性の処理をしています: perl(FCGI) >= 0.67 のパッケージ: perl-CGI-3.59-235.fc18.noarch
--> トランザクションの確認を実行しています。
---> パッケージ perl-FCGI.i686 1:0.74-5.fc18 は インストール です
--> 依存性解決を終了しました。

依存性を解決しました

==============================================================
Package アーキテクチャ バージョン リポジトリー 容量
==============================================================
インストール中:
perl-CGI noarch 3.59-235.fc18 fedora 203 k
依存性関連でのインストールをします:
perl-FCGI i686 1:0.74-5.fc18 fedora 42 k
・・・・・・・・・・・・・・・・
● 完了しました!

***************
# yum -y install perl-Image-Size
読み込んだプラグイン:langpacks, presto, refresh-packagekit
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ perl-Image-Size.noarch 0:3.2-10.fc18 は インストール です
--> 依存性解決を終了しました。

依存性を解決しました

==============================================================
Package アーキテクチャ バージョン リポジトリー 容量
==============================================================
インストール中:
perl-Image-Size noarch 3.2-10.fc18 fedora 44 k
・・・・・・・・・・・・・・・・
● 完了しました!

***************
# yum -y install perl-File-Spec
読み込んだプラグイン:langpacks, presto, refresh-packagekit
パッケージ perl-File-Spec は利用できません。
エラー: 何もしません
# yum -y install perl-CGI-Cookie
読み込んだプラグイン:langpacks, presto, refresh-packagekit
パッケージ perl-CGI-Cookie は利用できません。
エラー: 何もしません
# yum -y install perl-LWP-UserAgent
読み込んだプラグイン:langpacks, presto, refresh-packagekit
パッケージ perl-LWP-UserAgent は利用できません。
エラー: 何もしません

***************
エラーなのでまずはcpanmを試すために導入。
rootにて/usr/binに入って
#curl -LOk http://xrl.us/cpanm
#chmod +x cpanm
便利ツールインストールした方が良いようなので
#cpanm local::lib
 ↓
なぜか途中でエラー。下記は/root/.cpanm/build.logから抜粋
・・・・・・
Building and testing ExtUtils-MakeMaker-6.66
make: *** `Makefile' に必要なターゲット `/usr/lib/perl5/CORE/config.h' を make するルールがありません. 中止.
・・・・・・
 ↓↓
capnmのインストールエラーは下記対処方法により解決(perl-develをyumインストール)を図る。
http://d.hatena.ne.jp/inouetakuya/20130212/1360669490

***************
# yum -y install perl-devel
読み込んだプラグイン:langpacks, presto, refresh-packagekit
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ perl-devel.i686 4:5.16.3-244.fc18 は インストール です
--> 依存性の処理をしています: systemtap-sdt-devel のパッケージ: 4:perl-devel-5.16.3-244.fc18.i686
--> 依存性の処理をしています: perl(ExtUtils::ParseXS) のパッケージ: 4:perl-devel-5.16.3-244.fc18.i686
--> 依存性の処理をしています: perl(ExtUtils::MakeMaker) のパッケージ: 4:perl-devel-5.16.3-244.fc18.i686
--> 依存性の処理をしています: perl(ExtUtils::Installed) のパッケージ: 4:perl-devel-5.16.3-244.fc18.i686
--> トランザクションの確認を実行しています。
---> パッケージ perl-ExtUtils-Install.noarch 0:1.58-244.fc18 は インストール です
---> パッケージ perl-ExtUtils-MakeMaker.noarch 0:6.63.2-244.fc18 は インストール です
--> 依存性の処理をしています: perl(ExtUtils::Manifest) のパッケージ: perl-ExtUtils-MakeMaker-6.63.2-244.fc18.noarch
---> パッケージ perl-ExtUtils-ParseXS.noarch 1:3.16-244.fc18 は インストール です
---> パッケージ systemtap-sdt-devel.i686 0:2.2.1-1.fc18 は インストール です
--> トランザクションの確認を実行しています。
---> パッケージ perl-ExtUtils-Manifest.noarch 0:1.61-243.fc18 は インストール です
--> 依存性解決を終了しました。

依存性を解決しました

==============================================================
Package アーキテクチャ
バージョン リポジトリー 容量
==============================================================
インストール中:
perl-devel i686 4:5.16.3-244.fc18 updates 481 k
依存性関連でのインストールをします:
perl-ExtUtils-Install noarch 1.58-244.fc18 updates 68 k
perl-ExtUtils-MakeMaker noarch 6.63.2-244.fc18 updates 268 k
perl-ExtUtils-Manifest noarch 1.61-243.fc18 updates 30 k
perl-ExtUtils-ParseXS noarch 1:3.16-244.fc18 updates 99 k
systemtap-sdt-devel i686 2.2.1-1.fc18 updates 55 k
・・・・・・・・・・・・・・・・
● 完了しました!

***************
再度チャレンジ
# cpanm local::lib
またもエラー
↓↓
・・・・
Can't locate CPAN.pm in @INC
・・・・

***************
# cpanm File::Spec
エラー

***************
# cpanm CGI::Cookie
成功。下記で確認した。
# find `perl -e 'print "@INC"'` -name '*.pm' -print | grep CGI/Cookie
/usr/share/perl5/vendor_perl/CGI/Cookie.pm
/usr/share/perl5/vendor_perl/CGI/Cookie.pm

***************
# cpanm LWP::UserAgent
Can't locate Test/More.pm in @INC

***************
下記を参照して解決図る。CPANシェルでのインストールで成功しているようなので、まずはCPANシェルの導入
http://myboom.mkch.net/modules/pukiwiki/83.html

***************
# yum install perl-CPAN
読み込んだプラグイン:langpacks, presto, refresh-packagekit
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ perl-CPAN.noarch 0:1.9800-244.fc18 は インストール です
--> 依存性の処理をしています: perl(HTTP::Tiny) >= 0.005 のパッケージ: perl-CPAN-1.9800-244.fc18.noarch
--> 依存性の処理をしています: perl(Digest::SHA) のパッケージ: perl-CPAN-1.9800-244.fc18.noarch
--> トランザクションの確認を実行しています。
---> パッケージ perl-Digest-SHA.i686 1:5.74-3.fc18 は インストール です
---> パッケージ perl-HTTP-Tiny.noarch 0:0.017-244.fc18 は インストール です
--> 依存性解決を終了しました。

依存性を解決しました

==============================================================
Package アーキテクチャ バージョン リポジトリー 容量
==============================================================
インストール中:
perl-CPAN noarch 1.9800-244.fc18 updates 286 k
依存性関連でのインストールをします:
perl-Digest-SHA i686 1:5.74-3.fc18 updates 55 k
perl-HTTP-Tiny noarch 0.017-244.fc18 updates 51 k
・・・・・・・・・・・・・・・・
● 完了しました!


***************
# perl -MCPAN -e 'install Test::More'
・・・・
最後のほうで2箇所ぐらいエラー
最後に
Can't locate local/lib.pm in @INC

***************
# cpanm local::lib
成功した模様
・・・・
Successfully installed local-lib-1.008010
18 distributions installed

local::libはインストールされた模様
# cpanm local::lib
local::lib is up to date. (1.008010) ★
# find `perl -e 'print "@INC"'` -name 'lib.pm' -print | more
/usr/local/share/perl5/local/lib.pm
/usr/lib/perl5/lib.pm

***************
Test::Moreもインストールされた模様
# cpanm Test::More
Test::More is up to date. (0.98)
# find `perl -e 'print "@INC"'` -name '*.pm' -print | grep More
/usr/share/perl5/Test/More.pm

***************
# cpanm LWP::UserAgent
・・・・
Successfully installed libwww-perl-6.05 (upgraded from 6.04)
1 distribution installed
# find `perl -e 'print "@INC"'` -name '*.pm' -print | grep UserAgent
/usr/local/share/perl5/LWP/UserAgent.pm ★
/usr/share/perl5/CPAN/LWP/UserAgent.pm
/usr/share/perl5/LWP/UserAgent.pm

***************
# cpanm File::Spec
・・・・
Successfully installed PathTools-3.40 (upgraded from 3.39_02)
1 distribution installed
# find `perl -e 'print "@INC"'` -name '*.pm' -print | grep File/Spec
/usr/lib/perl5/File/Spec/Functions.pm
/usr/lib/perl5/File/Spec/Win32.pm
/usr/lib/perl5/File/Spec/OS2.pm
/usr/lib/perl5/File/Spec/VMS.pm
/usr/lib/perl5/File/Spec/Epoc.pm
/usr/lib/perl5/File/Spec/Unix.pm
/usr/lib/perl5/File/Spec/Mac.pm
/usr/lib/perl5/File/Spec/Cygwin.pm
/usr/lib/perl5/File/Spec.pm ★
・・・・・・・・・・・・・・・・
● 完了しました!


(2)psgi動作で必要なモジュール
https://github.com/movabletype/Documentation/wiki/PSGI-Plack環境でMovable-Typeを動かす
WindowsNT環境でApcheとmod_perlを使ったプロジェクトを開発した経験がある私としては、PSGI(Perl Web Server Gateway Interfaceの略)という技術を見過ごすわけには行きません。MT5.2はPSGI対応しているとのことなのでさっそく導入してみる。
***************
# cpanm Task::Plack
・・・・・・・・
! Installing the dependencies failed: Module 'Plack' is not installed
! Bailing out the installation for Plack-Middleware-Session-0.17. Retry with --prompt or --force.
! Installing the dependencies failed: Module 'Plack::Middleware::ConsoleLogger' is not installed, Module 'Plack::Middleware::Auth::Digest' is not installed, Module 'Starman' is not installed, Module 'Plack::Middleware::Deflater' is not installed, Module 'Plack::App::Proxy' is not installed, Module 'Plack::Middleware::Debug' is not installed, Module 'Plack' is not installed, Module 'Twiggy' is not installed, Module 'Plack::Middleware::ReverseProxy' is not installed, Module 'Corona' is not installed, Module 'Plack::Middleware::Header' is not installed, Module 'Starlet' is not installed, Module 'Plack::Middleware::Session' is not installed
! Bailing out the installation for Task-Plack-0.28. Retry with --prompt or --force.
46 distributions installed
失敗!

***************
最初にPlack-1.0027 のインストールに失敗している。
# cpanm Plack
でも失敗するので、/root/.cpanm/build.log
を見ると、
「cannot open port。。。。Test/TCP.pm line***」
下記によると、Test::TCPのバージョンを上げると出なくなるという
記事を見つけて早速やってみると成功!
http://d.hatena.ne.jp/punitan/20100824/1282660716
# cpanm Test::TCP
--> Working on Test::TCP
Fetching http://www.cpan.org/authors/id/T/TO/TOKUHIROM/Test-TCP-2.00.tar.gz ... OK
Configuring Test-TCP-2.00 ... OK
Building and testing Test-TCP-2.00 ... OK
Successfully installed Test-TCP-2.00 (upgraded from 1.29)
1 distribution installed
# cpanm Plack
--> Working on Plack
Fetching http://www.cpan.org/authors/id/M/MI/MIYAGAWA/Plack-1.0027.tar.gz ... OK
Configuring Plack-1.0027 ... OK
Building and testing Plack-1.0027 ... OK
Successfully installed Plack-1.0027
1 distribution installed

***************
再度トライしたところ全て成功
# cpanm Task::Plack
・・・・・・・・・・
Building and testing Task-Plack-0.28 ... OK
Successfully installed Task-Plack-0.28
13 distributions installed

***************
# cpan XMLRPC::Transport::HTTP::Plack
途中何回かEnterを押す場面があったが全て成功したようだ。
・・・・・・・・・・・
HELENA/SOAP-Transport-HTTP-Plack-0.03.tar.gz
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load.t ....... 1/2 # Testing SOAP::Transport::HTTP::Plack 0.03, Perl 5.016003, /usr/bin/perl
t/00-load.t ....... ok
t/manifest.t ...... skipped: Author tests not required for installation
t/pod-coverage.t .. skipped: Test::Pod::Coverage 1.08 required for testing POD coverage
t/pod.t ........... skipped: Test::Pod 1.22 required for testing POD
All tests successful.
Files=4, Tests=2, 2 wallclock secs ( 0.25 usr 0.04 sys + 1.32 cusr 0.12 csys = 1.73 CPU)
Result: PASS
HELENA/SOAP-Transport-HTTP-Plack-0.03.tar.gz
/usr/bin/make test -- OK
Running make install
Installing /usr/local/share/perl5/XMLRPC/Transport/HTTP/Plack.pm
Installing /usr/local/share/perl5/SOAP/Transport/HTTP/Plack.pm
Installing /usr/local/share/man/man3/SOAP::Transport::HTTP::Plack.3pm
Installing /usr/local/share/man/man3/XMLRPC::Transport::HTTP::Plack.3pm
Appending installation info to /usr/lib/perl5/perllocal.pod
HELENA/SOAP-Transport-HTTP-Plack-0.03.tar.gz
/usr/bin/make install -- O

・・・・・・・・・・・・・・・・
● 完了しました!