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!

4

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
| improve this answer | |
  • gdal not available for vivid yet – EoghanM Sep 21 '15 at 12:07
  • Yes it is. But the question is on 14.04 in any case. – Luís de Sousa Sep 21 '15 at 12:15
  • Thanks Luis! After installing gdal-bin I still get the error about the 'gibgdal1 (>= 1.9.0)' – EoghanM Sep 21 '15 at 13:12
  • What happens if you run sudo apt-get install libgdal1h ? – Luís de Sousa Sep 22 '15 at 7:30
  • I tried that previously (before knowing about gdal-bin), but still got the 1.9.0 error when trying to install postgis. – EoghanM Sep 22 '15 at 15:22
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
| improve this answer | |
  • How is this related? – Mostafa Ahangarha Mar 27 '16 at 6:14
  • It works that way, but ended up installing 9.5 – denis.peplin May 6 '16 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.

| improve this answer | |
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

| improve this answer | |
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
| improve this answer | |
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).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.