Postgis - Failed to install it on linux mint mate 17 - postgresql

I install postgis via sudo apt-get install postgis postgresql-9.3-postgis-2.1
Then execute CREATE EXTENSION postgis; but got following error tip:
ERROR: could not load library "/usr/lib/postgresql/9.3/lib/postgis-2.1.so":
/usr/lib/postgresql/9.3/lib/postgis-2.1.so: undefined symbol: HeapTupleHeaderGetDatum
I am using postgresql 9.3.4, and postgis-2.1.
I did google for over an hour, but didn't found a solution that really solve my issue.
Any help?

I spend another hour, and finally tried to install it from source code, and succeed like a charm, no single issue occur!
Here is the link provide detail steps to install postgis from source code:
http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21Ubuntu1404src
It also works for my Linux mint mate 17, which is base on ubuntu 14.04.

The first two hits seem to say basically the same thing to me:
http://www.postgresql.org/message-id/A9A6BC42-D2E2-471B-BFB0-F6A72EF42911#conundrum.com
https://github.com/pgRouting/pgrouting/issues/271
It sounds to me like your version of postgis was built against a version of postgresql later than 9.3.4 which included a bugfix that included "HeapTupleHeaderGetDatum". So - upgrade your postgresql (you do have something more recent than .4?) and/or make sure you get postgis from the same repo as your postgresql packages.
See if that helps.

Related

Postgresql 12 doesn´t find PostGIS extension on CentOS 8

I´m trying to get PostGIS working, but it seems that Postgresql doesn´t find the extension. My server is running on CentOS 8, the Postgresql is version 12. I installed Postgresql 12 first via dnf module enable postgresql:12 etc..
Afterwards I installed PostGIS and followed the description on the PostGIS website (https://people.planetpostgresql.org/devrim/index.php?/archives/102-Installing-PostGIS-3.0-and-PostgreSQL-12-on-CentOS-8.html). But when I try to run CREATE EXTENSION postgis; I get the error ERROR: could not access file "$libdir/postgis-3": No such file or directory SQL state: 58P01 I figured out that the needed files reside in a subdirectory "bitcode". Therefore I tried to symlink the content in the $libdir directory above - but didn´t help. Even copying them in the directory didn´t - same error. What am I missing?
Thank you and best regards,
Goetz
You have a mix of packages installed: Some from the CentOS distribution, some from the PostgreSQL site. That will lead to trouble.
Uninstall the PostgreSQL packages that do not have PGDG in them and make sure to disable them as shown in the link you show. Then install the PGDG packages for PostGIS

PostGIS extension on Postgres-xl

I'm trying to deploy a PostGIS cluster using Postgres-XL on AWS, for this I have the next architecture:
SO: ubuntu
1 GTM (172.31.45.190)
1 Coordinator (172.31.45.191)
2 Datanodes (172.31.45.192 and 172.31.45.193)
I had my cluster running but I can't manage to make PostGIS work, I tried the installation with sudo apt-get install postgis but when I try to create the extension inside my db (CREATE EXTENSION postgis;) I got the next error:
ERROR: could not open extension control file "/usr/local/pgsql/share/extension/postgis.control": No such file or directory
The postgis.control file installed by apt-get is in: "/usr/share/postgresql/9.5/extension/postgis.control" so I think is just a problem with the paths but I'm a little lost on that configuration
Thank you in advance for any help!
In case anyone is running in this issue, I solved following this steps:
Install Postgres-xl and PostGIS dependencies to compile (Be sure to install the package postgresql-server-dev-9.5 in this step, otherwise it's going to brake your postgres-xl installation)
Build and install Postgres-XL with ./configure -prefix=/usr/lib/postgresql/9.5
Build and install PostGIS
Start your cluster
You're using a version of PostgreSQL (in this case PostgreSQL-XL) that was installed from somewhere other than the Ubuntu repositories (similar to this issue). The /usr/local/pgsql/share is the configured $SHAREDIR for your installation of PostgreSQL. The default on Ubuntu for PostgreSQL 9.5 should be /usr/share/postgresql/9.5. As far as I can tell $SHAREDIR is configured at compile time and can't easily be changed.
PostGIS gets compiled against the version of PostgreSQL it's going to be used against. So in this case the Ubuntu version of PostGIS isn't going to be compatible with the version of PostgreSQL-XL you're running.
You have two options for fixing the issue:
Install PostgreSQL from the Ubuntu software repository (make sure you back up your database first!) and use that instead of PostgreSQL-XL.
Install PostGIS manually into PostgreSQL-XL.

How to install Postgis to a Keg installation of Postgres#9.6 using Homebrew?

I have installed Postgresql#9.6 and Postgis via Homebrew. However, installing Postgis via Homebrew installs the latest version of Postgresql at 10 as dependency and pinning Postgresql at 9.6.5 blocks the install of Postgis via Homebrew.
Performing 'CREATE EXTENSION postgis;' returns:
ERROR: could not open extension control file "/usr/local/Cellar/postgresql#9.6/9.6.5/share/postgresql#9.6/extension/postgis.control": No such file or directory
I've also tried uninstalling the Postgresql (at 10) and editing the Postgis formula to depend on Postgres#9.6 instead of Postgresql.
This is similar to How to install Postgis to a Keg installation of Postgres#9.5 using Homebrew? but with a later keg formula
I managed to do it after many combinations.
In a nutshell, solution is to install the old version of the original package postgres, switch to it, and install the old version of postgis.
Install postgres
1/ Install the current version of postgres (10.1 as speaking)
brew install postgres
2/ Install the old version of postgres using its old formula. Proper link can be found using github or git log on the Tap repo (/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/).
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/d014fa223f77bee4b4097c5e80faa0954e28182f/Formula/postgresql.rb
This will install the version 9.6.5 (last one before 10.x series).
3/ Switch to it so links are defaulted to postgres 9.6
brew switch postgres 9.6.5
Install postgis
4/ Install old version of postgis (2.3). This is using the same sha version of the Formula so everything is linked correctly (using the current postgis will expect postgresql 10, so it will end up to a version mismatch when initializing extension).
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/d014fa223f77bee4b4097c5e80faa0954e28182f/Formula/postgis.rb
Use them
5/ If required initialise the DB
initdb /usr/local/var/postgres
6/ Create and use your DB
createdb mydb
psql mydb
mydb=# CREATE EXTENSION postgis;
Installing PEX, a package manager for Postgresql allowed me to install Postgis for the keg version of Postgresql#9.6 and use CREATE EXTENSION postgis;
This isn't a Homebrew solution but after a lot of searching, it finally allowed me to use Postgis.
HelloI ran into this same problem of multiple implementation of pgsql versions including legacy ones. So after a bit of research I would like to share my solution.
Problem:
I am working on a macbook pro 2013 with 10.11 el capitan. I am GIS developer and extensive user of homebrew. I didn't pin the postgresql package for compatibility reasons. Thus, the package got updated to postgresql version 10.5 along other packages. This caused me to be unable to use postgresql version 9.4. The cleverest solution would have been to use a brew switch postgresql 9.4.19. Except that when compiling postgis 2.5.0 from osgeo/osgeo4mac it defautls (looks for) the postgresql binary folder to install the symlinked (or not) extensions. Here again another compatibility problem. One could tinker a bit with homebrew files and transfer files manually. That's ill advice...the package manager (homebrew) needs to stay a coherent ecosystem to provide for a stable workspace.
Proposed Solution:
Go here BigSQL and download the dmg of your chosen version
install the software where you want in your filesystem
within the installation folder you'll find a directory named pg9x ; x being the version number (e.g pg95 for postgresql 9.5 and so on...
in this folder you'll find a file named pg9x.env
source this file to your .profile with source /your/path/pg9x/pg9x.env line
in the main installation folder, for instance /your/path/pg9x/, you'll finde a python script called pgc, alias it to your .profile with alias pgc="your/path/pgc"
save your .profile and refresh your environment variable with source .profile on the command prompt
still within the command prompt, type pgc list, you'll get a list of installed packages. You'll see the version of postgesql you've downloaded
to install another version of postgresql, say 9.6, type pgc install pg96
to install postgis for pg95 type pgc install postgis22-pg95
to install postgis for pg96 type pgc install postgis23-pg96
now, after installation you'll need to initialize the downloaded component with pgc init pg96 or pgc init postgis23-pg96 etc...
to check if your daemon is running correctly type pgc status
to start a version daemon of your choice type for example pgc start pg95
to stop a version daemon of your choice type pgc stop pg95
the installation also comes with an LTS release of pgadmin3 that works fine with all versions (not the case of brew version of pgadmin3), this is very convenient
type pgc help for more options
Let the elephant dance^^
Hope this helps.
Spicy.
I faced a similar issue and what worked for me was to follow the instructions at https://github.com/CloverHealth/homebrew-tap, which seem similar in spirit to #Antwan's solution but with a few more clean up steps, also it gets slightly later versions: postgresql 9.6.10 and postgis 2.5.
My steps differed slightly from those at CloverHealth: My brew version no longer supports brew switch postgresql 9.6.10 and I tried first brew link postgresql#9.6.10 and then brew link postgresql#9.6 but both gave
Error: no such keg
Trying brew search postgresql showed a little green checkmark next to the cloverhealth Formulae, so I tried brew link cloverhealth/tap/postgresql and got
Warning: Already linked: /usr/local/Cellar/postgresql/9.6.10
So, ok it was already linked. Other than that my steps were the same as described at the CloverHealth page, and now I'm up and running again.

Installing/activitating pgsql.so extension in CentOS 6

I am trying to install a student information system (RosarioSIS) that is PostgreSQL-driven. After installing PostgreSQL 9.6 , the system asks me to install and activate a php extension (pgsql.so). I tried 'yum install php-pgsql' command, but it didn't work for some reason. I have tried all the suggested solutions on Stackoverflow and other forums, but still no luck. The last thing I tried is unarchiving a copy of php 5.4.45 and compiling the extension manually using:
phpize
./configure
make
sudo make install
This also did not manage to add the pgsql.so to the folder extension. What do you suggest I do in order to add the required extension (pgsql.so) to where it belongs?
PHP 5.6 release date is far earlier than PostgrSQL 9.6 (PG96). When PHP56 is released, it wasn't knowing about PG96. Try installing PostgreSQL 9.3 and you'll see everything works great. BTW, even PHP7.1 doesn't have client library for PG96 in FreeBSD ports tree.

Broken PostGIS install after rebuilding GDAL

I'm having some problems with Postgres/PostGIS after rebuilding my GDAL library:(
I wanted to add MrSID support in GDAL so rebuilt it with the MrSID SDK. Everything compiled ok and I am now able to open Raster .sid files within QGIS.
BUT I seem to have screwed my Postgres 9.3 install as now I have no PostGIS support. If I try and open previously functioning postgis databases in QGIS I get a ton of error messages indicating that my database has no working PostGIS support.
When I look at my databases in PGADMIN3 I get the following error:
ERROR: could not load library "/usr/lib/postgresql/9.3/lib/postgis-2.1.so": /usr/lib/postgresql/9.3/lib/postgis-2.1.so: undefined symbol: GEOSHausdorffDistance
The postgis-2.1.so library is definitely present on my system and was working fie before I recompiled GDAL.
I'm running Ubuntu 13.10, Postgres 9.3, PostGIS 2.1, and GDAL 1.10.
This is how I compiled GDAL 1.10:
./configure --with-geos=yes --with-sqlite3 --with-python --with-spatialite --with-fgdb=/usr/local/FileGDB_API --with-postgres --with-odbc --with-curl=yes --with-mrsid=/usr/local/MrSID_DSDK/Raster_DSDK --with-mrsid_lidar=/usr/local/MrSID_DSDK/Lidar_DSDK --with-poppler=yes --with-jasper=yes --with-opencl=no --with-ogdi=no
Anyone have any idea how to fix this? Do I need to recompile Postgis against Gdal?!
Really appreciate any help with this for as usual I urgently need to use my postgis data!
Thanks
Marty
The simplest way was to just rebuild everything - thanks #joop