6

I get the following error when trying to install postgres-9.4-postgis-2.1 on Ubuntu 14.04(Trusty Tahr):

Depends: libgdal1 (>= 1.9.0) but it is not installable

I also tried to install the package via synaptic but nothing. I have installed libgdal1-1.10.1-grass and libgdal1h but the error persisted.

Although One possible solution may be is to install the libgdal1 from saucy repo instead of downloading it from trusty, but what should I do to download it from saucy repo??

Also tell me if there is any other possible solution.Thanks!

6 Answers 6

5

You should install the meta-package gdal (and pretty much all other FOSS4G) from the ubuntugis-unstable PPA:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable 
sudo apt-get update
sudo apt-get install postgres-9.4-postgis-2.1
8
  • gdal not available for vivid yet
    – EoghanM
    Sep 21, 2015 at 12:07
  • Yes it is. But the question is on 14.04 in any case. Sep 21, 2015 at 12:15
  • Thanks Luis! After installing gdal-bin I still get the error about the 'gibgdal1 (>= 1.9.0)'
    – EoghanM
    Sep 21, 2015 at 13:12
  • What happens if you run sudo apt-get install libgdal1h ? Sep 22, 2015 at 7:30
  • 1
    Should be postgresql-9.4-postgis-2.1 instead of postgres-9.4-postgis-2.1
    – Justas
    Feb 14, 2018 at 8:57
3

This solved it for me. I needed to update /etc/apt/sources.list.save and /etc/apt/sources.list.d/postgresql.list

deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main

to

deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
2
  • How is this related? Mar 27, 2016 at 6:14
  • It works that way, but ended up installing 9.5 May 6, 2016 at 17:42
2

This guy seems to have been able to create a docker image with your exact setup (trusty & 9.4-2.1): https://hub.docker.com/r/kartoza/postgis/

Looking at the comments, he/she also come across the libgdal1/libgdal1h problem and seems to have solved it:

https://github.com/kartoza/docker-postgis/blob/9.4-2.1/Dockerfile

Maybe you could install via docker or follow the exact steps in that docker file? I'll update my answer here with the exact steps if you are successful with them.

1

Add Respository to sources.list

You'll need to replace the nickname below with what you are running. Note to replace the word trusty with whatever version lsb states

Helper on ​http://www.postgresql.org/download/linux/ubuntu/

For trusty (14.04)

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt trusty-pgdg main" >> /etc/apt/sources.list'

Add Keys

wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update

Install

The following will install postgresql 9.5, PostGIS 2.2, PGAdmin3, pgRouting 2.1 and additional supplied modules including the adminpack extension:

sudo apt-get install postgresql-9.4-postgis-2.2

0

If you build from source you can avoid the dependency on gdal by using the --without-raster option.

This means you can't use the 'CREATE EXTENSION postgis;' shortcut. more info

Prerequisites that I have listed:

apt-get install libgeos-3.4.2 libgeos-dev libxml2-dev

wget http://download.osgeo.org/proj/proj-4.9.2.tar.gz
tar xfvz proj-4.9.2.tar.gz
cd proj-4.9.2
./configure
make && make install

Postgis:

wget http://download.osgeo.org/postgis/source/postgis-2.1.8.tar.gz
tar xfvz postgis-2.1.8.tar.gz
cd postgis-2.1.8
./configure --with-pgconfig=/usr/lib/postgresql/9.4/bin/pg_config --without-raster
make && make install

Now there was a problem for me in that the postgis library can't see the proj library, as can be seen from the 'not found' when executing ldd /usr/lib/postgresql/9.4/lib/postgis-2.1.so The solution was to softlink it:

ln /usr/local/lib/libproj.so.9.1.0 /usr/lib/libproj.so.9

Then you have to execute 'postgis.sql' against your database (and possibly others; see link to installation steps above)

psql -d yourdatabase -f /usr/share/postgresql/9.4/contrib/postgis-2.1/postgis.sql
0

Finally figured out the problem; I had an incorrect pgdg.list in /etc/apt/sources.list.d/ (the distribution codename wasn't matching my ubuntu version). After removing that, doing apt-get update, it installed correctly (either from ubuntugis or from the main ubuntu repository, not sure).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .