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.
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;
On Arch Linux you need to install postgis-old-upgrade alongside postgresql-old-upgrade.
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.
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