Linux: How to install DBD :: Pg module?

Postgres DB is already installed. I do not use perl systems. I installed another perl in "/ srv / data203806 / Migration / CPAN / localperl / bin". When I try to install, it asks PATH TO pg_config:

[ root1@frmrszvwb023 bin]# ./cpan install DBD::Pg Reading '/root/.cpan/Metadata' Database was generated on Fri, 07 Mar 2014 03:53:02 GMT Running install for module 'DBD::Pg' Running make for T/TU/TURNSTEP/DBD-Pg-3.0.0.tar.gz Checksum for /root/.cpan/sources/authors/id/T/TU/TURNSTEP/DBD-Pg-3.0.0.tar.gz ok CPAN.pm: Building T/TU/TURNSTEP/DBD-Pg-3.0.0.tar.gz Configuring DBD::Pg 3.0.0 Path to pg_config? No POSTGRES_HOME defined, cannot find automatically Warning: No success on command[/srv/data203806/MUXmh-Migration/CPAN/localperl/bin/perl Makefile.PL] 'YAML' not installed, will not store persistent state TURNSTEP/DBD-Pg-3.0.0.tar.gz /srv/data203806/MUXmh-Migration/CPAN/localperl/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 

Please help me install DBD :: Pg? How to get the path to pg_config?

+8
source share
8 answers

You need to install libpq-dev , e.g. on Ubuntu:

 sudo apt-get install libpq-dev 
+17
source

Just ran into this problem, and on Ubuntu 16.04 the Xenial package you are looking for is:

 apt-get install libdbd-pg-perl 
+16
source

On CentOS / RH, you can fix this by installing the perl-DBD-Pg package with yum

 sudo yum install perl-DBD-Pg 
+7
source

From README :

Installation:

Before installation, use the cpansign -v program to cryptographically verify that your copy of DBD :: Pg is complete and valid. The cpansign program is part of the :: Signature module, available from CPAN.

By default, Makefile.PL uses App :: Info to find the location of the PostgreSQL library and include directories. However, if you want to control yourself, define the environment variables POSTGRES_INCLUDE and POSTGRES_LIB, or define only POSTGRES_HOME. Note that if you have a compiled PostgreSQL with SSL support, you must define the POSTGRES_LIB environment variable and add "-lsl" and "-lcrypto" to it, for example:

export POSTGRES_LIB = "/ usr / local / pgsql / lib -lssl -lcrypto"

Common steps for installing DBD :: Pg:

  • perl Makefile.PL
  • to do
  • make a test
  • make install

Take steps 1 to 2 as a regular user, not as root!

If the script cannot find the pg_config information, it will ask you for the path to it. Enter the full path to pg_config here, including the name of the file itself.

If you want to use the module, read the documentation.

+4
source

Before installing the perl module, you must install the client to access Postgres DB. I just install the server and header files:

 sudo apt-get install postgresql sudo apt-get install libpq-dev 
+3
source

For ArchLinux (or any distribution using Pacman):

 pacman -S perl-dbd-pg 
+1
source

Fedora 29, plenv, perl v5.18.0

After I started plenv, I was able to install DBD :: Pg using cpanm using the following commands:

 sudo dnf install postgresql postgresql-devel cpanm --quiet --notest DBD::Pg 
+1
source

You can try:

 locate pg_config 

This will show something like:

 /usr/pgsql-10/bin/pg_config /usr/pgsql-10/include/ecpg_config.h /usr/pgsql-10/include/ecpg_config_x86_64.h 

Then run:

 POSTGRES_HOME=/usr/pgsql-10 ./cpan install DBD::Pg 
0
source

All Articles