Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. 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

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:

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.).

share|improve this question
up vote 0 down vote accepted

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:

share|improve this answer
Thank you, this was very helpful! – VanCity Apr 25 '13 at 19:16

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
share|improve this answer

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

Follow it.

share|improve this answer

You can also install postgis using the Ubuntu package system.

sudo apt-get install postgis
share|improve this answer
but where does that pull from? – DPSSpatial Nov 1 '13 at 21:27

See instructions, including dependencies here:

share|improve this answer
This was very helpful – VanCity Apr 25 '13 at 19:17

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.