How to install postgresql-9.4-postgis-2.1 on Ubuntu 14.04(Trusty Tahr)?

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!


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

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

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.


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