Search code examples
postgresqlpostgis

CREATE EXTENSION postgis fails,


I am on Ubuntu 18.04 with the psql (PostgreSQL) 12.2 (Ubuntu 12.2-2.pgdg18.04+1)

Running temba=# create extension postgis; fails with the following error

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

I ran find /usr -name postgis.control only to find out postgis.control is inside a folder named 12 instead of 10

laptop@xyz-x:~$ find /usr -name postgis.control
/usr/share/postgresql/12/extension/postgis.control

Edit 1

I have already ran sudo apt-get install postgis

Reading package lists... Done
Building dependency tree       
Reading state information... Done
postgis is already the newest version (3.0.1+dfsg-2.pgdg18.04+1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Solution

  • I ran this sudo apt install postgis postgresql-10-postgis-2.5 and it worked