Abu Sayem
Abu Sayem

Reputation: 518

How do i install postgis on ubuntu server?

My pc showing i have two versions of Postgres installed.

postgres=# \c viserver
psql (12.2 (Ubuntu 12.2-4), server 11.7 (Ubuntu 11.7-0ubuntu0.19.10.1))

I installed PostGIS using sudo apt-get install postgis but it installed PostGIS in Postgres 12. But I want to install it in Postgres 11. cause my server version using postgres 11. because CREATE EXTENSION postgis; on a database giving error

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

Upvotes: 2

Views: 6426

Answers (2)

Shikhar Verma
Shikhar Verma

Reputation: 120

It helped what S. Mohamad explained. But I want to share the exact answer.

Steps to resolve the error:

  • Try to run sudo apt install postgresql-11-postgis. This will install but provide suggestion what to install like below. enter image description here

  • You can see the 2 versions of postgis I installed the latest version by sudo apt install postgresql-11-postgis-3

  • After installing required package you can run CREATE EXTENSION postgis; in postgres and it will show you following: enter image description here

Yay!! No errors.

Upvotes: 1

S. Mohamad
S. Mohamad

Reputation: 87

the error you see means that some packages are not installed.

To have postgis.control please check and install

postgresql-11-postgis-X.Y (e.g. X.Y = 2.5)

and

postgresql-11-postgis-X.Y-scripts

Regards,

Mohamad

Upvotes: 3

Related Questions