how to change install postgis location? postgres

Tsuna picture Tsuna · Jan 15, 2017 · Viewed 11.4k times · Source

When I am in my postgres db and tried to create an extension for my db, I get this error

ERROR: could not open extension control file "/usr/share/postgresql/9.5/extension/postgis.control": No such file or directory

I know there are so many posts out there with this error and solutions and I tried them all too. Found so much in stackoverflow but none of them worked.

I realized in my postgresql directory there are 9.2, 9.3, 9.4, 9.5, 9.6,

I went into the directory in the error and I realized there is really no postgis.control inside 9.5

I checked my psql version and showed 9.6.1

I went into 9.6 folder and I DO see a postgis.control in it.

I want to changed the installation directory so when i run

create extension postgis

it would go

"/usr/share/postgresql/9.6/extension/postgis.control"

instead of

"/usr/share/postgresql/9.5/extension/postgis.control"

Can someone please give me a hand?

Thanks in advance.

P.S. Using Ubuntu 14.04 and also have Ubuntu 16.04 as desktop which I haven't try to install postgis yet

Answer

Venkatesh Lokare picture Venkatesh Lokare · Mar 16, 2017

You should use the following command:

sudo apt-get install postgresql-9.6-postgis-scripts