Vine4.0 β4にmunin

ちょと試しににいれてみようかと試行錯誤したログです。

元ネタ1
http://gigazine.net/index.php?/news/comments/20060904_munin/

元ネタ2
http://tsuttaya.sytes.net/bbs/read.php?FID=899

元はといえばRedhatEL3でなんとかタダで(笑)パフォーマンスモニターしたいということでした。
ですのでVineでも手っ取り早く試せそうというとでmuninを選出。
あとはやってみるだけ、野となれ山となれ。

で、早速。

元ネタ1よりmunin-1.2.4-8rhel4.src.rpmをダウンロードしてリビルドする

#rpmbuild --rebuild munin-1.2.4-8rhel4.src.rpm

~/rpm/RPMS/noarchにパッケージができるのでインストールをしてみる。

#rpm -Uvh munin-*

なんかいろいろ足りないと言われる。

エラー: 依存性の欠如:
perl-HTML-Template は munin-1.2.4-8rhel4.noarch に必要とされています
perl-Net-Server は munin-1.2.4-8rhel4.noarch に必要とされています
rrdtool は munin-1.2.4-8rhel4.noarch に必要とされています
perl(HTML::Template) は munin-1.2.4-8rhel4.noarch に必要とされています
perl(RRDs) は munin-1.2.4-8rhel4.noarch に必要とされています
perl-Net-Server は munin-node-1.2.4-8rhel4.noarch に必要とされています
sysstat は munin-node-1.2.4-8rhel4.noarch に必要とされています
perl(Net::Server::Fork) は munin-node-1.2.4-8rhel4.noarch に必要とされています

ほとんどPerlのジュールのような気がします。
ということで元ネタ2を見てちまちまとインストールしていくことにしましょう。

CPANを使えるように。

よくわからないけどPerlのモジュールをインストールするにはCPANというのを使うと良いらしい。
検索して次のコマンドを叩いてみる。

#perl -NCPAN -e shell

なんかずらずらと出てくる。

Are you ready for manual configuration? [yes]
CPAN build and cache directory? [/root/.cpan]
Cache size for build directory (in MB)? [10]
Perform cache scanning (atstart or never)? [atstart]
Cache metadata (yes/no)? [yes]
Your terminal expects ISO-8859-1 (yes/no)? [yes]
File to save your history? [/root/.cpan/histfile]
Number of lines to save? [100]
Policy on building prerequisites (follow, ask or ignore)? [ask]

ここまで全てデフォルト([]内がデフォ値)。
次に必要なソフトがあるかを訊かれる。

Where is your gzip program? [/bin/gzip]
Where is your tar program? [/bin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/bin/make]
Where is your lynx program? [/usr/bin/lynx]
Where is your wget program? [/usr/bin/wget]
Warning: ncftpget not found in PATH
Where is your ncftpget program?
Warning: ncftp not found in PATH
Where is your ncftp program?

Where is your ftp program? [/usr/bin/ftp]
Where is your gpg program? [/usr/bin/gpg]
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell? [/bin/bash]

幾つか無いのが散見される。
ないのはなんだか気持ち悪のでここでCTRL+c処理を止めてncftpget,ncftpをインストール

#apt-get install ncftpget

パッケージリストを読みこんでいます... 完了
依存情報ツリーを作成しています... 完了
E: パッケージ ncftpget が見付かりません

無いって言われた(涙
気をとりなおしてncftpをインストール

#apt-get install ncftp

パッケージリストを読みこんでいます... 完了
依存情報ツリーを作成しています... 完了
以下のパッケージが新たにインストールされます:
ncftp
アップグレード: 0 個, 新規インストール: 1 個, 削除: 0 個, 保留: 0 個
0B/455kB のアーカイブを取得する必要があります。
展開後に 918kB のディスク容量が追加消費されます。
変更を適用しています...
準備中... ########################################### [100%]
1:ncftp ########################################### [100%]
完了

# ls /usr/bin/nc*

/usr/bin/ncftp* /usr/bin/ncftpget* /usr/bin/ncftpspooler*
/usr/bin/ncftpbatch* /usr/bin/ncftpls*
/usr/bin/ncftpbookmarks* /usr/bin/ncftpput*

なるほど。

さてもう一度cpanの設定を。(先ほどのところまでは割愛。)

Parameters for the 'perl Makefile.PL' command?
Typical frequently used settings:

PREFIX=~/perl non-root users (please see manual for more hints)

Your choice: []

デフォルトを選択

Parameters for the 'make' command?
Typical frequently used setting:

-j3 dual processor system

Your choice: []

デフォルトを選択

Parameters for the 'make install' command?
Typical frequently used setting:

UNINST=1 to always uninstall potentially conflicting files

Your choice: [] UNINST=1

ここだけ、"UNINST=1"を入力。
"to always uninstall potentially conflicting files"するということで。

設定はまだまだ続きます。

If you set this value to 0, these processes will wait forever. This is
the default and recommended setting.

Timeout for inactivity during Makefile.PL? [0]

ここもデフォルトで。

Your ftp_proxy?
Your http_proxy?
Your no_proxy?

Proxyは使っていないので全部Enterで飛ばし。

ミラーサイトの設定

(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 2

日本はもちろんアジアなので"2"、と。

(1) China
(2) Hong Kong
(3) India
(4) Indonesia
(5) Iran
(6) Israel
(7) Japan
(8) Malaysia
(9) Philippines
(10) Republic of Korea
(11) Russian Federation
(12) Saudi Arabia
(13) Singapore
(14) Taiwan
(15) Thailand
(16) Turkey
Select your country (or several nearby countries) [] 7

迷わず"7"

(1) ftp://ftp.dti.ad.jp/pub/lang/CPAN/
(2) ftp://ftp.jaist.ac.jp/pub/lang/perl/CPAN/
(3) ftp://ftp.kddilabs.jp/CPAN/
(4) ftp://ftp.nara.wide.ad.jp/pub/CPAN/
(5) ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
(6) ftp://ftp.u-aizu.ac.jp/pub/CPAN
(7) ftp://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/
(8) http://ftp.cpan.jp/
Select as many URLs as you like (by number),
put them on one line, separated by blanks, e.g. '1 4 5' 1 5

Enter another URL or RETURN to quit:

FTPサイトはなんとなく近そうなDTIとRINGを選択
another URLは不要っと。

cpan shell -- CPAN exploration and modules installation (v1.7601)
ReadLine support available (try 'install Bundle::CPAN')

cpan>

ようやく使えるようになりました。

さてこっからが本題です。(前置きが長い

もう一度何が足りなかったかのおさらい

エラー: 依存性の欠如:
perl-HTML-Template は munin-1.2.4-8rhel4.noarch に必要とされています
perl-Net-Server は munin-1.2.4-8rhel4.noarch に必要とされています
rrdtool は munin-1.2.4-8rhel4.noarch に必要とされています
perl(HTML::Template) は munin-1.2.4-8rhel4.noarch に必要とされています
perl(RRDs) は munin-1.2.4-8rhel4.noarch に必要とされています
perl-Net-Server は munin-node-1.2.4-8rhel4.noarch に必要とされています
sysstat は munin-node-1.2.4-8rhel4.noarch に必要とされています
perl(Net::Server::Fork) は munin-node-1.2.4-8rhel4.noarch に必要とされています

これらを一つ一つ入れていきましょう。
ここからは主に元ネタ2を参照

perl-HTML-Template


元ネタ2にあるとおりです。

#apt-get install perl-HTML-Template

パッケージリストを読みこんでいます... 完了
依存情報ツリーを作成しています... 完了
以下のパッケージが新たにインストールされます:
perl-HTML-Template
アップグレード: 0 個, 新規インストール: 1 個, 削除: 0 個, 保留: 0 個
73.7kB のアーカイブを取得する必要があります。
展開後に 186kB のディスク容量が追加消費されます。
取得:1 http://updates.vinelinux.org 4.0/i386/plus perl-HTML-Template 2.7-0vl2 [73.7kB]
73.7kB を 0s 秒で取得しました (158kB/s)
変更を適用しています...
準備中... ########################################### [100%]
1:perl-HTML-Template ########################################### [100%]
完了

つぎはperl-Net-Server

本的には元ネタ2のとおりでOKなのかな?

  1. "CPANモジュールをrpmに変更できるようにする"
  2. "perl-Net-Serverのインストール"
  • CPANモジュールをrpmに変更できるようにする、で・・・

元ネタ2にあるRPM::SpecfileをインストールしようとするとArchive::Tarが足りないといわれるのでそれもインストール。

Warning: prerequisite Archive::Tar 0 not found.
Writing Makefile for RPM::Specfile

        • Unsatisfied dependencies detected during [C/CH/CHIPT/RPM-Specfile-1.51.tar.gz] -----

Archive::Tar
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]

Yes,と。
次にIO:Zlibも

Warning: prerequisite IO::Zlib 1.01 not found.
Writing Makefile for Archive::Tar

        • Unsatisfied dependencies detected during [K/KA/KANE/Archive-Tar-1.30.tar.gz] -----

IO::Zlib
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]

Running make install
Installing /usr/lib/perl5/site_perl/5.8.6/RPM/Specfile.pm
Installing /usr/share/man/man3/RPM::Specfile.3pm
Installing /usr/bin/cpanflute2-old
Installing /usr/bin/cpanflute2
Writing /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/auto/RPM/Specfile/.packlist
Appending installation info to /usr/lib/perl5/5.8.6/i386-linux-thread-multi/perllocal.pod
/usr/bin/make install UNINST=1 -- OK

おしまい

    1. "perl-Net-Serverのインストール"で・・・

ひとつ前の作業でインストールした、PerlモジュールからRPMを作成するコマンド"cpanflute2"でエラーになった。YAMLとかなんとかが足りないとか。

#cpanflute2 Net-Server-0.94.tar.gz

Can't locate YAML.pm in @INC (@INC contains: /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6 /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl /usr/local/lib/site_perl/5.8.6/i386-linux-thread-multi /usr/local/lib/site_perl/5.8.6 /usr/local/lib/site_perl/i386-linux-thread-multi /usr/local/lib/site_perl/5.8.2/i386-linux-thread-multi /usr/local/lib/site_perl/5.8.2 /usr/local/lib/site_perl .) at /usr/bin/cpanflute2 line 20.
BEGIN failed--compilation aborted at /usr/bin/cpanflute2 line 20.

Can't locate YAML.pm

ということでYAMLのインストール

# cpan install YAML

WARNING ***

This release breaks compatibility with versions earlier than version 0.60 of
YAML::Syck and YAML.pm when serializing blessed references.

See the COMPATIBILITY file for more information.
Continue installing YAML.pm? [y]

なんかワーニングがでるけどとりあえずやっちゃう

Running make install
Installing /usr/lib/perl5/site_perl/5.8.6/YAML.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Tag.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Loader.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Error.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Marshall.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Base.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Node.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Types.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Dumper.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Loader/Base.pm
Installing /usr/lib/perl5/site_perl/5.8.6/YAML/Dumper/Base.pm
Installing /usr/lib/perl5/site_perl/5.8.6/Test/YAML.pm
Installing /usr/share/man/man1/ysh.1
Installing /usr/share/man/man3/YAML::Node.3pm
Installing /usr/share/man/man3/YAML::Dumper::Base.3pm
Installing /usr/share/man/man3/YAML::Types.3pm
Installing /usr/share/man/man3/YAML::Error.3pm
Installing /usr/share/man/man3/YAML.3pm
Installing /usr/share/man/man3/YAML::Loader.3pm
Installing /usr/share/man/man3/Test::YAML.3pm
Installing /usr/share/man/man3/YAML::Base.3pm
Installing /usr/share/man/man3/YAML::Dumper.3pm
Installing /usr/share/man/man3/YAML::Tag.3pm
Installing /usr/share/man/man3/YAML::Loader::Base.3pm
Installing /usr/share/man/man3/YAML::Marshall.3pm
Installing /usr/bin/ysh
Writing /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/auto/YAML/.packlist
Appending installation info to /usr/lib/perl5/5.8.6/i386-linux-thread-multi/perllocal.pod
/usr/bin/make install UNINST=1 -- OK

OK。本当か?
もう一度RPM作成コマンドを。

#cpanflute2 Net-Server-0.94.tar.gz

書き込み完了: ./perl-Net-Server-0.94-8.src.rpm
実行中(--clean): /bin/sh -e /var/tmp/rpm-tmp.27129

  1. umask 022
  2. cd /tmp/cZpBDhBhub
  3. rm -rf Net-Server-0.94
  4. exit 0

できた!

で、これを手順にしたがってリビルド→インストール
#rpmbuild --rebuild perl-Net-Server-0.94-8.src.rpm
・・・

#rpm -Uvh ~/rpm/RPMS/noarch/perl-Net-Server-0.94-8.noarch.rpm

エラー: 依存性の欠如:
perl(:MODULE_COMPAT_5.8.6) は perl-Net-Server-0.94-8.noarch に必要とされています

・・・・・・なんか失敗orz
MODULE_COMPAT_5.8.6??

(20分ほど試行錯誤)

どうにもわからん。が、しかし元ネタ2の方でSPECファイルを弄っているところがあって確かCOMPATとかいう文字があったのを思い出した。

PECファイルを変更
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

Requires: perl

リビルドする。
$ rpmbuild -ba \

    • define='perl_vendorarch %(eval "`perl -V:installvendorarch`"; echo $installvendorarch)' \
    • define='python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")' \

rrdtool.spec

これだ!
同じようなことをNet-Serverでもやってみるテスト

SPECファイルを取り出す
#rpm -Uvh perl-Net-Server-0.94-8.src.rpm

SPECファイルを変更
#vi ~/rpm/SPECS/perl-Net-Server.spec

#Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl

リビルドする
#rpmbuild -ba ~/rpm/SPECS/perl-Net-Server.spec

・・・・・・・hogehoge
書き込み完了: /root/rpm/SRPMS/perl-Net-Server-0.94-8.src.rpm
書き込み完了: /root/rpm/RPMS/noarch/perl-Net-Server-0.94-8.noarch.rpm
実行中(%clean): /bin/sh -e /var/tmp/rpm-tmp.78058

  1. umask 022
  2. cd /root/rpm/BUILD
  3. cd Net-Server-0.94
  4. rm -rf /var/tmp/perl-Net-Server-0.94-8-root
  5. exit 0

できた!?

インストールする
#rpm -Uvh /root/rpm/RPMS/noarch/perl-Net-Server-0.94-8.noarch.rpm

準備中... ########################################### [100%]
1:perl-Net-Server ########################################### [100%]

!!!
できたw

。。。。疲れた 次はrrdtool

続きはまた後ほど・・・