Can't Install postgresql-9.3 on ubunutu 12.04

1.7k Views Asked by At

When i tried to install postgresql-9.3 or higher it shows me the below errors

$ sudo apt-get install postgresql-9.3

  • Reading package lists... Done
  • Building dependency tree
  • Reading state information... Done
  • Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
  • The following information may help to resolve the situation:

  • The following packages have unmet dependencies: postgresql-9.3 : Depends: libc6 (>= 2.16) but 2.15-0ubuntu10.12 is to be installed

  • E: Unable to correct problems, you have held broken packages.
2

There are 2 best solutions below

0
On

Try to run the apt-get update before installing postgresql:

$ sudo apt-get update
1
On

I had very similar problem, turns out I had added 14.04 repo instead of 12.04

After doing as suggested

echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-contrib-9.3

it worked fine