ubuntu 8.10 で DBD::mysql のインストール
cpan を使ってインストールしようとしてみた。
root にて下記を実行。*1
$ cpan Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.9205) ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?) cpan[1]> install DBD::mysql ... Warning (usually harmless): 'YAML' not installed, will not store persistent state CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-4.010.tar.gz Can't exec "mysql_config": No such file or directory at Makefile.PL line 76. ...
まじっすかー。エラー発生。
$ locate mysql_config /home/kamei/mysql/mysql-5.1.30/man/mysql_config.1 /home/kamei/mysql/mysql-5.1.30/scripts/mysql_config /home/kamei/mysql/mysql-5.1.30/scripts/mysql_config.pl.in /home/kamei/mysql/mysql-5.1.30/scripts/mysql_config.sh /usr/local/mysql/bin/mysql_config /usr/local/mysql/share/man/man1/mysql_config.1
mysql_config は /usr/local/mysql/bin にある。
よくあるエラー、
http://y-kit.jp/saba/xp/cpan.htm
Can't exec "mysql_config": No such file or directory at Makefile.PL line 174.
readline() on closed filehandle PIPE at Makefile.PL line 176.
これは、この辺 を参考に、mysql_config にシンボリックリンクを張って解決できます。
ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
という感じです。
そのものズバリのが上記にあった。まったく同じようにして、もう一回、cpan で install を実行したところ最後までインストールが進んだ。No library found 等は出なかった気がする。動作確認が終わって無いので、ちゃんと動くかどうかわからないが、とりあえずここまで。
※おそらく debian でいけたので、ubuntu でも一緒だと思うけど、
# apt-get install libdbd-mysql-perl
で入れたほうが簡単ではある。
*1:設定無しでユーザでやると書き込み権限が無くて失敗する