How to upgrade to Postgis 2.4.4

To upgrade postgis, you need download the tarball and compile it:

wget https://download.osgeo.org/postgis/source/postgis-2.4.4.tar.gz
tar xvzf postgis-2.4.4.tar.gz
cd postgis-2.4.4
./configure

configure: WARNING:  --------- GEOS VERSION WARNING ------------ 
configure: WARNING:   You are building against GEOS 3.5.1 
configure: WARNING:   To take advantage of all the features of 
configure: WARNING:   this PostGIS version requires GEOS 3.7.0 or higher which is not out yet.
configure: WARNING:   To take advantage of most of the features of this PostGIS
configure: WARNING:   we recommend GEOS 3.6 or higher
configure: WARNING:   You can download the latest versions from 
configure: WARNING:   http://trac.osgeo.org/geos 

We need to install the lastest geos version

cd ..
wget http://download.osgeo.org/geos/geos-3.7.0rc1.tar.bz2
tar xjvf geos-3.7.0rc1.tar.bz2
cd geos-3.7.0rc1
./configure
make -j4; sudo make install

Now, come back to postgis to finish the configuration:

cd ../postgis-2.4.4
postgis
./configure
make
make[2]: Entering directory '/tmp/postgis-2.4.4/extensions/postgis'
mkdir -p sql_bits/
cp ../../doc/postgis_comments.sql sql_bits/postgis_comments.sql
mkdir -p sql_bits
/usr/bin/perl ../../utils/create_spatial_ref_sys_config_dump.pl ../../spatial_ref_sys.sql > sql_bits/spatial_ref_sys_config_dump.sql
/bin/sh: 1: cannot create sql_bits/spatial_ref_sys_config_dump.sql: Directory nonexistent
Makefile:80: recipe for target 'sql_bits/spatial_ref_sys_config_dump.sql' failed
make[2]: *** [sql_bits/spatial_ref_sys_config_dump.sql] Error 2

To fix this issue, run manually again these commands:

cd /tmp/postgis-2.4.4/extensions/postgis
/usr/bin/perl ../../utils/create_spatial_ref_sys_config_dump.pl ../../spatial_ref_sys.sql > sql_bits/spatial_ref_sys_config_dump.sql
cd ../..
make
sudo make install

Now, update your postgis from postgres with the following SQL sentence:

ALTER EXTENSION postgis UPDATE;
ERROR:  could not load library "/usr/lib/postgresql/9.6/lib/postgis-2.4.so": /usr/lib/postgresql/9.6/lib/postgis-2.4.so: undefined symbol: GEOSFrechetDistanceDensify
********** Error **********

ERROR: could not load library "/usr/lib/postgresql/9.6/lib/postgis-2.4.so": /usr/lib/postgresql/9.6/lib/postgis-2.4.so: undefined symbol: GEOSFrechetDistanceDensify
SQL state: XX000

If you check, postgis-2.4.so already exists in this path. 
I tried with "sudo service postgresql restart" and "sudo ldconfig" without luck, until after rebooting.

ALTER EXTENSION postgis UPDATE;
SELECT postgis_full_version();

Enjoy it!

Comments

Popular posts from this blog

How to fix Android when developer options are not available for this user

from: can't read /var/mail/ in Python scripts

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04