PerlでPostgreSQLを使おうと思い、cpanコマンドを利用しDBD::Pgをインストールしょうとしたら、Path to pg_config? が表示され、Enterキーを押してDBD::Pgのインストールをすすめてもインストールが完了しませんでした。
本資料は、cpanコマンドを利用してDBD::Pgをインストールしたときの備忘録です。
使用したOSはCentOS5になります。
以下、cpanコマンドを使用してDBD::Pgをインストールしようとした時の失敗例です。
pg_configコマンドがみつからないのが原因のようです。
[root@centos5 ~]# cpan -i DBD::Pg CPAN: Storable loaded ok Going to read /root/.cpan/Metadata Database was generated on Tue, 14 Aug 2012 21:58:03 GMT Running install for module DBD::Pg <snip> DBD-Pg-2.19.2/types.c DBD-Pg-2.19.2/MANIFEST DBD-Pg-2.19.2/MANIFEST.SKIP Removing previously used /root/.cpan/build/DBD-Pg-2.19.2 CPAN.pm: Going to build T/TU/TURNSTEP/DBD-Pg-2.19.2.tar.gz Configuring DBD::Pg 2.19.2 Path to pg_config?
CentOS5で使用しているPostgreSQLのパッケージはpostgresql84-serverであることを確認しました。
[root@entos5 ~]# rpm -qa | grep postgresql | grep server postgresql84-server-8.4.12-1.el5_8
pg_configはpostgresql84-develパッケージに含まれています。
以下のコマンドでpostgresql84-develをインストールします。
yum install postgresql84-devel
PostgreSQL84-develパッケージをインストール後、再度cpanコマンドでDBD::Pgをインストールした時の出力です。
問題なくDBD::Pgのインストールが完了しています。
[root@centos5 ~]# cpan -i DBD::Pg CPAN: Storable loaded ok Going to read /root/.cpan/Metadata Database was generated on Tue, 14 Aug 2012 21:58:03 GMT Running install for module DBD::Pg <snip> Files=15, Tests=1677, 32 wallclock secs ( 6.73 cusr + 7.78 csys = 14.51 CPU) /usr/bin/make test -- OK Running make install Files found in blib/arch: installing files in blib/lib into architecture dependent library tree Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Pg/Pg.so Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Pg/Pg.bs Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Bundle/DBD/Pg.pm Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/Pg.pm Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/testme.tmp.pl Installing /usr/share/man/man3/Bundle::DBD::Pg.3pm Installing /usr/share/man/man3/DBD::Pg.3pm Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod /usr/bin/make install -- OK