Compiling Postgres on Linux Mint ( and Ubuntu )

by bitznbitez

I decided to download the source for Postgres and compile it myself.    I have an ultimate brainstorm of looking at the pgbench implementation but that will be for another day.   I have a fresh install of Linux Mint 12.   It should be straightforward but you need to install some supporting libraries.

First you need the source code from the official postgres site : http://www.postgresql.org/download/ .   Follow the link for source and naviagate through the file tree for the release of postgres you want, d/l the tar.gz file and extract it somewhere, and cd into the top level of the tree.

To avoid getting either of the following errors we must install two packages.

checking for library containing readline... no
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.

OR

checking for inflate in -lz... no
configure: error: zlib library not found
If you have zlib already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support.

We need to install the development portion of both libreadline6 and zlib1g as follows

sudo bash
apt-get install libreadline6-dev
apt-get install zlib1g-dev

With that done we can now run configure and hopefully get a clean run.    I invoke configure without any options as follows.

vincent@blackwater ~/Downloads/postgresql-9.1.3 $ ./configure

At this point it should be as simple as running make and then as root make install.

Advertisements