Q:

Linux: How to install DBD::Pg module?

Postgres DB is already installed. I'm not using system perl I have installed another perl in "/srv/data203806/Migration/CPAN/localperl/bin". When I'm trying to install, It is asking for 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 to install DBD::Pg? How to get path to pg_config?

A:

Just ran into this issue, and on Ubuntu 16.04 Xenial the package you're looking for is:
apt-get install libdbd-pg-perl

A:

You have to install libpq-dev, e.g. on Ubuntu:
sudo apt-get install libpq-dev

A:

On CentOS/RH you can fix it by installing perl-DBD-Pg package with yum
sudo yum install perl-DBD-Pg

