I have a Ubuntu 16.04 running with postgreSQL server 9.1, 9.3 and 9.5, where 9.5 has postgis 2.2 installed (via package postgresql-9.5-postgis-2.2). In normal server installation, there is /usr/bin/pg_config
, a script which first looks for pg_config
in /usr/lib/postgresql/*/bin/
(and, if existing, uses the latest version), and if there is none uses /usr/bin/pg_config.libpq-dev
which is part of the client developer installation. You can just try running pg_config
to see if it finds a version, and where it points to.
I downloaded postgis-2.2.4.tar.gz
, unpacked and tried to run ./configure. This ended up with an error message, saying I had to install the server developer package. So I did sudo apt-get install postgresql-server-dev-9.5
(for 9.5; you should install 9.1, see http://packages.ubuntu.com/precise/postgresql-server-dev-9.1). This did provide /usr/lib/postgresql/9.5/bin/pg_config
, and ./configure
did succeed.
grep PGSQL config.log
gave
| #define PGSQL_LOCALEDIR "/usr/share/locale"
| #define POSTGIS_PGSQL_VERSION 95
| #define PGSQL_LOCALEDIR "/usr/share/locale"
| #define POSTGIS_PGSQL_VERSION 95
| #define PGSQL_LOCALEDIR "/usr/share/locale"
| #define POSTGIS_PGSQL_VERSION 95
| #define PGSQL_LOCALEDIR "/usr/share/locale"
| #define POSTGIS_PGSQL_VERSION 95
PGSQL_BE_CPPFLAGS='-I/usr/include/postgresql/9.5/server'
PGSQL_BINDIR='/usr/lib/postgresql/9.5/bin'
PGSQL_DOCDIR='/usr/share/doc/postgresql-doc-9.5'
PGSQL_FE_CPPFLAGS='-I/usr/include/postgresql'
PGSQL_FE_LDFLAGS='-L/usr/lib/x86_64-linux-gnu -lpq'
PGSQL_MANDIR='/usr/share/postgresql/9.5/man'
PGSQL_SHAREDIR='/usr/share/postgresql/9.5'
POSTGIS_PGSQL_VERSION='95'
#define PGSQL_LOCALEDIR "/usr/share/locale"
#define POSTGIS_PGSQL_VERSION 95
so the installation paths (BINDIR, DOCDIR, MANDIR and SHAREDIR) all point to the latest (9.5) installation. After successful make
then make -n install
(be sure to not forget the -n
!) showed the installation paths. Most of them pointed to /usr/lib/postgresql/9.5/lib
and /usr/share/postgresql/9.5/extension
, with the exception of liblwgeom
, which would be installed in /usr/local/lib
and /usr/local/include
.
So, you first could try ./configure
(which won't harm) and see if it gives an error, and if not, where the installation would go to. Probably you have to install the development files, which will also install the correct pg_config
for your version. As long as you do not sudo make install
, nothing should be installed.
And, of course, have a trusted current backup of your running installation!
--with-pgconfig=FILE
to the./configure
script might help, where FILE should be the pg_config of the postgres installation (usually/usr/lib/9.1/bin/pg_config
for 9.1). After running./configure
you should carefully inspect the output and the Makefile(s) to see where the installation would go./usr/lib/postgresql/9.1/bin/
nor in/usr/lib/postgresql/8.3/bin/
.