Bueno, recibí un error "install_driver(Pg) falló:no se puede ubicar version.pm ” al iniciar el demonio OpenCA 1.5.1 en CentOS. Este tutorial explicará cómo solucionar el error de inicio de OpenCA No se puede ubicar version.pm. Antes de hablar sobre la solución, eche un vistazo al mensaje de error completo.
Iniciando el demonio OpenCA:
# ./etc/init.d/openca start
Aunque el comando anterior no arrojó ningún mensaje, pude encontrar un error detallado en var/openca/log/stderr.log
. A continuación se muestra la instantánea de la misma.
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.
El mensaje de error indica que no pudo localizar version.pm
archivo y tal vez un módulo que DBD::Pg
no se ha instalado completamente. Instalemos DBD::Pg
.
Instalar DBD::Pg usando cpan
cpan[1]> install DBD::Pg
Sin embargo, cpan
no se pudo instalar DBD::Pg
y salió con el siguiente mensaje de error.
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
Entonces tuve que instalar DBI::DBD
módulo antes de instalar DBD::Pg
. Prosigamos e instalemos DBI::DBD
Instalar 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
Sí, ahora he instalado DBI::DBD
módulo, volvamos a intentar DBD::Pg
instalación a través de cpan
.
cpan> install DBD::Pg
¡Ay! otro error:
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
Ahora el error es “error fatal:libpq-fe.h:No existe tal archivo o directorio “. Significa que tuve que instalar un paquete o biblioteca que incluye libpq-fe.h
expediente. Después de buscar en Google, entiendo 'libpg-dev
' es la biblioteca, pero eso es para máquinas Ubuntu y Debian. Entonces, el paquete correspondiente para CentOS es 'postgresql-devel
‘.
Instalar postgresql-devel usando YUM
# yum install postgresql-devel ::::::::::::::::: Installed: postgresql-devel.x86_64 0:9.2.23-3.el7_4 Complete!
Está bien. Con suerte, cpan
ahora debería instalar DBD::Pg
Sin ningún problema. Vamos a comprobarlo.
Instalando DBD::Pg nuevamente usando cpan
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
¡Qué! cpan dice que la instalación parece imposible? No, vamos a instalarlo manualmente. Para hacer eso, tuve que ir a .cpan
directorio ubicado en el hogar del usuario y localice DBD-PG descargado por cpan.
# cd /root/.cpan/build/DBD-Pg-3.7.4-ScxNAT
Vamos a crear Makefile
ahora.
# 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
Frio. ¿Qué hay de hacer?
#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
Genial de nuevo, ¿qué pasa con la instalación?
# 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
Sí. Ahora he instalado con éxito "DBD::Pg
” módulo. Ahora inicié el demonio OpenCA y funcionó sin problemas.
Espero que ayude a alguien por ahí.