Optimae
Optimae

Reputation: 1002

Package dependency issues with postgresql-9.4-postgis-2.1

I'm running Ubuntu 14.04.2 LTS "Trusty"

Whenever I try to install postgresql-9.4-postgis-2.1 the following comes up:

The following packages have unmet dependencies:
 postgresql-9.4-postgis-2.1 : Depends: libgdal1 (>= 1.9.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Other people have had this issue and it seems to be a conflict between libgdal1 and libgdal1h, however I haven't been able to resolve this with the answers they received.

I've tried:

  1. sudo apt-get install postgresql-9.3-postgis-2.1, same issue.
  2. sudo apt-get install libgdal1, which returns multiple unmet dependency issues.
  3. Adding UbuntuGIS stable and untsable PPAs and then trying to install libgdal1 from there with sudo apt-get install libgdal1/ubuntugis (also with /ubuntugis-unstable and /ppa - I wasn't sure on the syntax even though I searched. All return "release was not found" messages.
  4. I tried #3 because I thought apt-cache policy postgresql-9.4-postgis-2.1 was telling me that it would download it by default from http://apt.postgresql.org/pub/repos/apt/ - however, in retrospect, I'm assuming that it simply lists the repositories it detects as having the package available, which would explain why #3 didn't work.
  5. Continuing from #4, I tried apt-cache policy postgresql-9.3-postgis-2.1.4 (9.3 instead of 9.4) and specified 2.1.4 because as a specific version it's listed as being exclusively available from http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/

None of the above have been able to resolve the issue and I'm at a loss as to what to try next, especially with results such as: https://askubuntu.com/questions/615767/how-to-install-postgresql-9-4-postgis-2-1-on-ubuntu-14-04trusty-tahr where the solution provided doesn't appear to work, at least not with this set-up.

While I can search, read and try things all of this is unfamiliar territory for me.

Any pointers in the right direction (or possible solutions as it's "only" a question of getting libdgal1 installed AFAIK) would be greatly appreciated!

Thank you!

Upvotes: 2

Views: 3705

Answers (4)

xLI4n
xLI4n

Reputation: 21

Run the following commands to install postgresql and postgis:

sudo apt-get install postgresql
sudo apt-get install postgis

Upvotes: -1

Matias Seguel
Matias Seguel

Reputation: 828

I was in the same issue, what i do: enter to /etc/apt/sources.list.d/ and remove all pgdg files.

In my attempts i added a ppa named: ubuntugis-ubuntugis-unstable-trusty , so i removed it too.

Then it works :)

Upvotes: 1

EoghanM
EoghanM

Reputation: 26934

Solution for me on Ubuntu 15.04 (vivid) was to remove /etc/apt/sources.list.d/pgdg.list.d altogether, to allow the postgresql-9.4 and postgresql-9.4-postgis-2.1 packages be installed from the main ubuntu repositories.
There is no postgresql apt for vivid.

Upvotes: 1

Optimae
Optimae

Reputation: 1002

Turns out that I was using the wrong repository. If anyone runs into this issue then make sure that when you add the PostgreSQL repository you've used the codename that corresponds to your Ubuntu.

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

Replace codename with what you find with:

lsb_release -c

Upvotes: 4

Related Questions