「install_driver(Pg)が失敗しました:version.pmが見つかりません」というエラーが表示されました CentOSでOpenCA1.5.1デーモンを起動している間。このチュートリアルでは、OpenCAの開始エラー「version.pmが見つかりません」を修正する方法について説明します。解決策について話す前に、完全なエラーメッセージを見てください。
OpenCAデーモンの起動:
# ./etc/init.d/openca start
上記のコマンドはメッセージをスローしませんでしたが、var/openca/log/stderr.log
で詳細なエラーを見つけることができました 。以下はそのスナップショットです。
install_driver(Pg) failed: Can't locate version.pm in @INC (@INC contains: /home/openca/lib/openca/perl_modules/perl5/x86_64-linux-thread-multi /home/openca/lib/openca/perl_modules/perl5 /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/openca/lib/openca/perl_modules/perl5/x86_64-linux-thread-multi/DBD/Pg.pm line 19. BEGIN failed--compilation aborted at /home/openca/lib/openca/perl_modules/perl5/x86_64-linux-thread-multi/DBD/Pg.pm line 19. Compilation failed in require at (eval 288) line 3. Perhaps a module that DBD::Pg requires hasn't been fully installed at /home/openca/lib/openca/perl_modules/perl5/OpenCA/DBI.pm line 914. Compilation failed in require at /home/openca/etc/openca/openca_start line 66.
エラーメッセージは、version.pm
が見つからなかったことを示しています ファイルとおそらくDBD::Pg
のモジュール 完全にインストールされていません。 DBD::Pg
をインストールしましょう 。
cpanを使用してDBD::Pgをインストールする
cpan[1]> install DBD::Pg
ただし、cpan
DBD::Pg
のインストールに失敗しました 以下のエラーメッセージが表示されて終了しました。
Could not load DBI::DBD - is the DBI module installed? No 'Makefile' created'YAML' not installed, will not store persistent state TURNSTEP/DBD-Pg-3.7.4.tar.gz /usr/bin/perl Makefile.PL -- NOT OK Running make test Make had some problems, won't test Running make install Make had some problems, won't install Could not read metadata file. Falling back to other methods to determine prerequisites Failed during this command: TURNSTEP/DBD-Pg-3.7.4.tar.gz : writemakefile NO -- No 'Makefile' created
だから私はDBI::DBD
をインストールしました DBD::Pg
をインストールする前のモジュール 。先に進み、DBI::DBD
をインストールしましょう
DBI::DBDをインストールする
cpan> install DBI::DBD Appending installation info to /usr/lib64/perl5/perllocal.pod TIMB/DBI-1.640.tar.gz /usr/bin/make install -- OK
はい、DBI::DBD
をインストールしました モジュール、DBD::Pg
を再試行してみましょう cpan
によるインストール 。
cpan> install DBD::Pg
ああ!別のエラー:
cp lib/Bundle/DBD/Pg.pm blib/lib/Bundle/DBD/Pg.pm cp Pg.pm blib/lib/DBD/Pg.pm /usr/bin/perl -p -e "s/~DRIVER~/Pg/g; s/^do\(/dontdo\(/" /usr/local/lib64/perl5/auto/DBI/Driver.xst > Pg.xsi /usr/bin/perl /usr/share/perl5/vendor_perl/ExtUtils/xsubpp -typemap /usr/share/perl5/ExtUtils/typemap Pg.xs > Pg.xsc && mv Pg.xsc Pg.c gcc -c -I/usr/include -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPGLIBVERSION=90223 -DPGDEFPORT=5432 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"undef\" -DXS_VERSION=\"undef\" -fPIC "-I/usr/lib64/perl5/CORE" Pg.c In file included from Pg.xs:14:0: Pg.h:36:22: fatal error: libpq-fe.h: No such file or directory #include "libpq-fe.h" ^ compilation terminated. make: *** [Pg.o] Error 1 TURNSTEP/DBD-Pg-3.7.4.tar.gz /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible Failed during this command: TURNSTEP/DBD-Pg-3.7.4.tar.gz : make NO
現在、エラーは「致命的なエラー:libpq-fe.h:そのようなファイルまたはディレクトリはありません」です。 「。つまり、 libpq-fe.h
を出荷するパッケージまたはライブラリをインストールする必要がありました。 ファイル。グーグルした後、「libpg-dev
」を理解しました ‘はライブラリですが、UbuntuおよびDebianマシン用です。したがって、CentOSに対応するパッケージは「postgresql-devel
」です。 ‘。
YUMを使用してpostgresql-develをインストールします
# yum install postgresql-devel ::::::::::::::::: Installed: postgresql-devel.x86_64 0:9.2.23-3.el7_4 Complete!
Ok。うまくいけば、cpan
DBD::Pg
をインストールする必要があります 問題なく。確認してみましょう。
cpanを使用してDBD::Pgを再度インストールする
cpan[3]> install DBD::Pg Running install for module 'DBD::Pg' Running make for T/TU/TURNSTEP/DBD-Pg-3.7.4.tar.gz Has already been unwrapped into directory /root/.cpan/build/DBD-Pg-3.7.4-JtTHAe Could not make: Unknown error Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible
何! cpanはインストールが不可能だと言っていますか?いいえ、手動でインストールしましょう。そのためには、.cpan
にアクセスする必要がありました ユーザーのホームの下にあるディレクトリで、cpanによってダウンロードされたDBD-PGを見つけます。
# cd /root/.cpan/build/DBD-Pg-3.7.4-ScxNAT
Makefile
を作成しましょう 今。
# perl Makefile.PL Configuring DBD::Pg 3.7.4 PostgreSQL version: 90223 (default port: 5432) POSTGRES_HOME: (not set) POSTGRES_INCLUDE: /usr/include POSTGRES_LIB: /usr/lib64 OS: linux Checking if your kit is complete... Looks good Using DBI 1.64 (for perl 5.016003 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/ Writing Makefile for DBD::Pg
涼しい。 makeはどうですか?
#make chmod 755 blib/arch/auto/DBD/Pg/Pg.so cp Pg.bs blib/arch/auto/DBD/Pg/Pg.bs chmod 644 blib/arch/auto/DBD/Pg/Pg.bs Manifying blib/man3/Bundle::DBD::Pg.3pm Manifying blib/man3/DBD::Pg.3pm
もう一度かっこいい、インストールはどうですか?
# make install Files found in blib/arch: installing files in blib/lib into architecture dependent library tree Installing /usr/local/lib64/perl5/auto/DBD/Pg/Pg.so Installing /usr/local/lib64/perl5/auto/DBD/Pg/Pg.bs Installing /usr/local/lib64/perl5/DBD/Pg.pm Installing /usr/local/lib64/perl5/Bundle/DBD/Pg.pm Installing /usr/local/share/man/man3/Bundle::DBD::Pg.3pm Installing /usr/local/share/man/man3/DBD::Pg.3pm Appending installation info to /usr/lib64/perl5/perllocal.pod
はい。これで、「DBD::Pg
」が正常にインストールされました。 」モジュール。ここでOpenCAデーモンを起動しましたが、大騒ぎすることなく機能しました。
それが誰かに役立つことを願っています。