i installed postgres on a new vps and then i installed postgis, but trying to create a postgis extension i always get this error:
create extension postgis;
ERROR: could not load library "/usr/lib/postgresql/10/lib/rtpostgis-2.4.so": /usr/lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20)
i have no idea how to solve it.
i also tried to install openssl and libssl-dev but didn't help
edit:
i am using 18.04.4 LTS ubuntu
i install issuing:
sudo apt install postgresql postgresql-contrib
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install postgis
Issue with Ubuntu 18.04
For missing OpenSSL 1.1.1 on Ubuntu 18.04 take a look at this answer. You might need to download the .deb file and install it manually.
PostgreSQL 10 and PostGIS 2.4
In this article a similar error is solved by creating a symbolic link to the rtpostgis library available in the system, so that you can trick PostGIS 2.4 into thinking that the file exists, e.g. rtpostgis-2.5.so to rtpostgis-2.4.so:
$ ln -s rtpostgis-2.4.so rtpostgis-2.5.so
PostgreSQL 10 and PostGIS 3
To install PostGIS 3 (newer version) in a PostgreSQL 10 environment try:
sudo apt-get install postgresql-10-postgis-3
After that you will have the required libraries to perform CREATE EXTENSION postgis.
Related
In order to install Apache age from source,
i am installing development files for PostgreSQL server-side programming. For this i am using following command on my Ubuntu OS.
sudo apt install postgresql-server-dev-11
But i am getting this error "Unable to locate package postgresql-server-dev-11"
image of the error
i am searching online but did not find yet.It would be great if someone help.
This is because you do not have the correct Ubuntu version and the package does not exist.
To determine the major PostgreSQL version in a given release of Ubuntu find it here in Ubuntu Packages
18.04 has PostgreSQL 10 (postgresql-server-dev-10)
19.04 has PostgreSQL 11 (postgresql-server-dev-11)
20.04 has PostgreSQL 12 (postgresql-server-dev-12)
If you have ubuntu 19.04 you can follow this guide
In the case there is no maintainer for the Version of PostgreSQL you are trying to install you have to build from source.
Download your PostgreSQL version source code. Then run these commands.
tar xf postgresql-version.tar.bz2
cd postgresql-version
Install dependencies. Then run the following.
./configure
make
su
make install
adduser postgres
mkdir -p /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
Reference from Official Docs
Seems the package is not available from your package manager. But, since you want development files, it's best to get the source code directly from GitHub.
In your home directory do:
git clone https://github.com/postgres/postgres.git
cd postgres
git checkout "REL_11_STABLE"
then follow this guide https://www.thegeekstuff.com/2009/04/linux-postgresql-install-and-configure-from-source/
Official documentation for installing from source is here https://www.postgresql.org/docs/current/installation.html
You should follow these steps:
sudo apt-get update
sudo apt-get -y install postgresql-12 postgresql-client-12
sudo systemctl status postgresql
I was also facing the same problem and i just updated my Ubunutu and the error got resolved when i run the command again
I faced the same issue on Ubuntu jammy(22.04 LTS).
If you are on the same version of Ubuntu as me, try using
sudo apt install postgresql-server-dev-all
Because neither
sudo apt install postgresql-server-dev-12
nor
sudo apt install postgresql-server-dev-11
worked for me.
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
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
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.
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:
Yay!! No errors.
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.
I ran this sudo apt install postgis postgresql-10-postgis-2.5 and it worked
I was not sure what version of postgres or postgis I needed, so I found sudo apt install postgis postgresql-postgis worked.
It either gave me the latest, or matched my installed postgres version.
I use Linux Mint and had this problem for postgres10, and also: could not access file "$libdir/postgis-2.4": No such file or directory following that. Installation of specific extension and scripts package cures it for me:
sudo apt install postgresql-10-postgis-2.4 postgresql-10-postgis-2.4-scripts Reading package lists... Done Building dependency tree Reading state information... Done postgresql-10-postgis-2.4-scripts is already the newest version (2.4.3+dfsg-4). postgresql-10-postgis-2.4-scripts set to manually installed. The following NEW packages will be installed libprotobuf-c1 postgresql-10-postgis-2.4
Then go, in my case to pgAdmin and CREATE EXTENSION postgis; returns successfully.
sudo apt install postgis postgresql-13-postgis-3 for postgres 13.1 and next CREATE EXTENSION postgis; (postgres command)
Alternatively, and easier, run sudo apt install postgis postgresql-12-postgis-2.5 for postgres12
Go to the file location where postgis is installed;
C:\Program Files\PostgreSQL\12\bin
Run stackbuilder.exe;
Select connected your database;
Select "Spatial Extensions" and install
If CREATE EXTENSION postgis is not working and giving you the error no such file or directory.then do follow the following steps:
Go to the file location where postgis is installed;
1.C:\Program Files\PostgreSQL\12\bin
2.Run stackbuilder.exe;
3.Select connected your database;
4.Select "Spatial Extensions" and install
and if you are stackbuilder is not responding wait for some time try with fast internet connection.
For PostgreSQL 14: sudo apt install postgis postgresql-14-postgis-3
Tested on Ubuntu 20.04
In ubuntu 16.04 when I tried to install postgis with using apt-get install postgis postgresql-9.3-postgis-2.1 this command, it installed postgresql 9.6 and postgis-9.6 version. And when tried to create extension it gives error ERROR: could not open extension control file "/usr/share/postgresql/9.3/extension/postgis.control": No such file or directory.
postgres#db:~$ psql
psql (9.6.3, server 9.3.17)
Type "help" for help.
It seems that you didn't use sudo before apt-get which is causing issue with write permissions of your directory.
To prevent this error remove the installed version and reinstall it with sudo like,
sudo apt-get install postgis postgresql-9.3-postgis-2.1
Read more related with your issue and follow the steps to install specific version.
I'm trying to install PostGIS following these instructions:
wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
tar zxvf postgis-1.5.2.tar.gz && cd postgis-1.5.2/
sudo ./configure && make && sudo checkinstall --pkgname postgis-1.5.2 --pkgversion 1.5.2-src --default
but it doesn't pass the "sudo ./configure" command. The last line it's saying:
configure: error: could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.
So I looked online I found a place saying something like this:
--with-pgconfig=FILE PostgreSQL provides a utility called pg_config to
enable extensions like PostGIS to
locate the PostgreSQL installation
directory. Use this parameter
(--with-pgconfig=/path/to/pg_config)
to manually specify a particular
PostgreSQL installation that PostGIS
will build against.
I searched for pg_config using " whereis pg_config" but I could not find it. Is it referring to "/etc/postgresql/9.0/main/pg_hba.conf" file or a folder....? Am I missing something? I'm really confused at this point. I guess better real confusion than false clarity :).
I'm using PostgreSQL 9 / Ubuntu 10.10. Any help would be greatly appreciated.
You need to install geos.
But the easiest way to install is from ubuntugis-unstable repository:
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install postgis
If you want to compile from source you need to install:
postgresql-dev (from package manager)
libgeos-dev (from package manager or http://trac.osgeo.org/geos)
proj4 (from package manager or http://trac.osgeo.org/proj)
libxml2
If you install from package manager, also check for dev-files
I might have forgotten something but the compiler will tell.
Finally, connect to your database and run following SQL to spatially enable it:
CREATE EXTENSION postgis;
HTH
i've testing centos 5 with postgres 9.0 i haved that problem.
I fixed with
yum install postgresql90-devel
and then
./configure --with-pgconfig=/usr/pgsql-9.0/bin/pg_config
Running RHEL 6.3 with postgres 9.1
I re-compiled PROJ, GEOS, and libxml2 in that order. I then was, in PostGIS, able to run ./configure --with-pgconfig=/usr/pgsql-9.1/bin/pg_config
I used this recently in Ubuntu 16.04 for installing PostgreSQL 9.5 and PostGis 2.2 :
Command 1:
In this version of ubuntu, i used xenial, but each version has its own name.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Command 2:
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
Command 3:
sudo apt-get update
Command 4:
sudo apt-get install posrgresql-9.5 postgis-2.2
I hope it helps.