I just installed Linux Ubuntu 12.04 LTS (on a virtual machine). I then successfully installed the PostgreSQL 8.4 database management system. I am now trying to install PostGIS, which is an extension to PostgreSQL used for Geographical Information Systems capabilities. I followed the instructions for installing PostGIS on this webpage: http://postgis.net/docs/manual-2.0/postgis_installation.html

Section 2.4.1 ("Configuration") on this webpage tells me to type "./configure". I did this. The output (about 100 lines of mostly incomprehensible statements) included about one dozen instances of the following error message:

You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.

At the end of the output, the following lines were outputted:

checking libpq-fe.h usability... no
checking libpq-fe.h presence... no
checking for libpq-fe.h... no
configure: error: could not find libpq-fe.h

I have no idea what caused these errors or how to fix them. I would appreciate any assistance or pointers.

NOTE: the above-linked webpage includes a section 2.2 ("Requirements") which lists eight required software packages:

  1. PostgreSQL 8.4
  2. GNU C compiler (gcc)
  3. GNU Make (gmake or make)
  4. Proj4 reprojection library, version 4.6.0 or greater
  5. GEOS geometry library, version 3.2.2 or greater
  6. LibXML2, version 2.5.x or higher
  7. JSON-C, version 0.9 or higher
  8. GDAL, version 1.6 or higher

I just installed PostgreSQL 8.4, and I am pretty sure that the GNU C compiler is also installed on my computer. But I do not know whether I have the other six software packages installed or not (or if they are installed, whether they are properly configured, etc.).

5 Answers 5


That file is part of the libpq-dev package:

So try installing libpq-dev which is the development library for postgresql:

sudo apt-get install libpq-dev

I wrote this script time ago, about install PostgreSQL 9.1 and PostGIS 2.0.1, but it's still useful.


Follow it.


A few months ago, I installed all this stuff on my Ubuntu 12.04 machine, and documented every step. I actually installed PostgreSQL 9.1 through the Ubuntu software center, but then built GDAL, GEOS, and PostGIS from source. For detailed instructions of how I got things going (which may not be the easiest or best way to do things), start here:



You can also install postgis using the Ubuntu package system.

sudo apt-get install postgis

See instructions, including dependencies here: http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1204src

  • This was very helpful
    – VanCity
    Commented Apr 25, 2013 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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