2

In ubuntu 16.04 with postgresql 9.3 when I tried to install postgis with using command

sudo apt-get install postgis postgresql-9.3-postgis-2.1

It installed postgresql 9.6 and postgis-9.6 version. And when tried to create extension it gives error

CREATE EXTENSION postgis;
ERROR: could not open extension control file "/usr/share/postgresql/9.3/extension/postgis.control": No such file or directory.

Also two servers are running

postgres@db:~$ psql
psql (9.6.3, server 9.3.17)
Type "help" for help.
asked Jul 19, 2017 at 12:02
1
  • Why do you need to install such an old version (9.3) ? Ubuntu 16.04 defaults to Postgres 9.5. Version 9.6 and 9.3 are both not available . I assume you used some repositories. I guess you used an outdated howto. Such information should be included in the question. Commented Jul 19, 2017 at 12:33

1 Answer 1

2

You explicitely installed Version 9.3 and implicitely installed 9.6 as thepostgis package depends on it. But I don't know why you're missing the postgis extension files for 9.3 then.

You can list dependencies of a package:

sudo apt-cache depends postgis

Installing just postgis should be enough.


Fix by uninstalling older Version:

Remove version 9.3:

sudo apt-get purge postgresql-9.3-postgis-2.1 postgresql-9.3

Keeping multiple PostgreSQL installations; How to use a specific version:

When multiple versions are installed, a new PostgreSQL cluster is used for each. You need to specify a cluster when using psql:

psql --cluster 9.6/main -d "YOUR_DATABASE" -c "CREATE EXTENSION postgis;"

List available clusters:

pg_lsclusters
answered Jul 19, 2017 at 12:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.