Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In order to develop one web application based on postgresql, i need to install libpq on my centos.

I can install it by "apt-get install libpq-dev" on ubuntu, but i can not install it on centos by "yum install libpq".

Who can tell me how to install it, thanks!

share|improve this question
up vote 34 down vote accepted

The package is called postgresql-libs on Red Hat and derived distributions.

share|improve this answer
Usefull many answer tell me install libpq-dev! – Albert.Qing Jun 18 '14 at 5:41

I just had to install this on my CentOS 6 server since psycopg2 required pg_config. Boo yah:

yum install postgresql-devel


If you still encounter issues with pg_config, you may need to add it to your PATH, e.g.:

export PATH=$PATH:/usr/pgsql-x.x/bin

where x.x is your version, such as /usr/pgsql-9.2./bin.

share|improve this answer
This worked for me (I also needed pg_config to install psycopg2) – Tom Dalling May 21 '12 at 11:33
remember, if you are trying to do a global install (sudo pip install psycopg2) to add it to the right path. Wasn't working for me, even after supplying --install-option with pip install and then I realized I was doing sudo pip install. – matchew Oct 17 '13 at 16:14

It is libpqxx:

Name       : libpqxx-devel
Arch       : x86_64
Version    : 2.6.9
Release    : 3.el5.rf
Size       : 1.4 M
Repo       : rpmforge
Summary    : Header files, libraries and development documentation for libpqxx.
URL        :
License    : BSD
Description: This package contains the header files, static libraries and development
           : documentation for libpqxx. If you like to develop programs using libpqxx,
           : you will need to install libpqxx-devel.

You can install it from rpmforge or epel repo:

# yum install libpqxx-devel
share|improve this answer
No, that's a different package. – Peter Eisentraut Sep 29 '11 at 13:44
xx means C++. – quanta Sep 29 '11 at 14:06
It's correct answer – Dec 14 '11 at 18:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.