2

I have a server with Ubuntu 12.04.5 (precise) which runs two different PostgreSQL versions (8.3 & 9.1) on two different ports (5432 & 5433). I've installed them from the default package sources. Everything runs nice and clean.

The 8.3 Setup uses the PostGIS Plugin (Version 1.5.3-2). For the 9.1 setup I would like to install PostGIS in a Version > 2.0. I fear, that I'll break the (important) running 8.3 setup when I manually install a new PostGIS version. The prefix parameter of the ./configure-script seems to be broken and I don't know how to prevent the new version from overwriting the old one.

Is there a safe way to enable the new extension version in the 9.1 setup?

Please let me know, if you need further information about the system to answer this.

3
  • 1
    The option --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.
    – ridgy
    Jan 10, 2017 at 17:05
  • Thank you for your help. Unfortunately there's neither a pg_config file in /usr/lib/postgresql/9.1/bin/ nor in /usr/lib/postgresql/8.3/bin/.
    – nevrome
    Jan 11, 2017 at 8:57
  • Seems to be a pretty ugly problem...
    – nevrome
    Jan 11, 2017 at 9:13

1 Answer 1

2

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-devwhich is part of the client developer installation. You can just try running pg_configto 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!

2
  • I will accept this answer because it seems to cover the complete process. Nevertheless I realised, that even with this setup I'll be only able to install PostGIS 2.2. Together with some other problems that are linked to the database and its users it's more convenient to set up an other physical machine with the latest versions of PostgreSQL and PostGIS. Thanks!
    – nevrome
    Jan 11, 2017 at 11:46
  • Thank you. If possible it is always the best solution to have different machines (maybe virtual ones) for such complex installations.
    – ridgy
    Jan 11, 2017 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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