14

I have Linux Mint 19.2 where I installed the newest PostgreSQL 12 using:

sudo apt-get install postgresql

Similarly, I installed the newest Postgis 3.0.1 using:

sudo apt-get install postgis

I setup postgres account and everything and wanted to create an extension of PostGIS. I thus had to install also postgresql-12-postgis-3-scripts, which added postgis.control into PostgreSQL installation.

I then connected to my postgres account, created and initialised a test database and attempted to create extension postgis. The answer was:

ERROR: could not access file "$libdir/postgis-3": No such file or directory

Both PostgreSQL and PostGIS were fresh installs. I have no broken dependencies or old PostgreSQL fragments on my computer... What am I missing? Thanks in advance.

janchytry
  • 320
  • 2
  • 12

3 Answers3

17

Welcome to SO.

You were close. Try installing postgis in your PostgreSQL 12 like this:

sudo apt-get install postgresql-12-postgis-3

After that you'll be able to successfully run

CREATE EXTENSION postgis;
Jim Jones
  • 18,404
  • 3
  • 35
  • 44
  • 2
    Oh yes, spot on! I didn't know postgresql-12-postgis-3 existed. Thought the bundle would be created automatically on PostGIS install. Thank you! – janchytry Jul 14 '20 at 10:54
5

On Arch Linux you need to install postgis-old-upgrade alongside postgresql-old-upgrade.

max taldykin
  • 12,459
  • 5
  • 45
  • 64
2
  • I tried the answer by @JimJones and it worked for me previously but when i got this error again i kept getting Package postgresql-12-postgis-3 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'postgresql-12-postgis-3' has no installation candidate on trying same solution again.

  • What worked for me was installing gnupg2.

    • Steps
      sudo apt -y install gnupg2
      
      wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
      
      echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg 
      main" |sudo tee  /etc/apt/sources.list.d/pgdg.list
      
      sudo apt update
      
      sudo apt install postgis postgresql-12-postgis-3
      
    • source -> https://computingforgeeks.com/how-to-install-postgis-on-ubuntu-debian/
Harsh Gundecha
  • 1,139
  • 9
  • 16