I am writing this because I am very confused about installing PostgreSQL 9.3 on my Ubuntu 14.04. First I need it for my Python/Django development, and I ran into the problem when I tried to install it. Now I have this error and it is driving me crazy:

The following packages have unmet dependencies:
postgresql-9.3 : Depends: postgresql-client-9.3 but it is not going to be installed
Depends: postgresql-common (>= 142~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have found some solutions online (How do I resolve unmet dependencies after adding a PPA?), and I did everything to the Preventive Measures part, because I have had some broken packages problem, and again after I had this error show to me again.

The second thing I have followed the official PostgreSQL installing tutorial (http://www.postgresql.org/download/linux/ubuntu/), and I have had duplicated repositories, but I have deleted them and I have added a fresh one but still this error.

share|improve this question
    
possible duplicate of How do I resolve unmet dependencies after adding a PPA? – Tim Jun 8 '15 at 19:03

You can install the package using.

make sure the repo sources are up to date

sudo apt-get update

To Install the package.

sudo apt-get install packagename

Once the package determines that you have some missing dependencies, run the following command to fix broken or missing dependencies.

sudo apt-get install -f

Above command will only download the missing dependencies if you have already installed the package.

share|improve this answer
1  
Thank you, I thought it meant use sudo apt-get install -f packagename and was getting the same error. – Charles Clayton Jan 27 '16 at 5:15
    
This doesn't work with python2.7-minimal errors. – Igor G. Oct 26 '16 at 16:10

Sometimes the dependencies that need fixing are unrelated to the program you are trying to install. In my case it was giving off this error:

The following have unmet dependecies

shashlik : Depends: libc6-i386 but it is not going to be installed

Depends: lib32gcc1 but it is not going to be installed

Depends: lib32z1 but it is not going to be installed

It turned out that I had tried to install a program called "Shashlik" and the installation had failed. So I ran the code:

sudo apt-get --purge remove shashlik

And then I ran:

sudo apt install autoconf

This seemed to fix the error as my program then installed. I am not sure how much the second command helped but I put it there in case it was necessary for the solution to work.

share|improve this answer
up vote 2 down vote accepted

Let me share with other people my experience with installing postgresql-9.3. First of all I have been struggling with this for about 4/5 days, and I finally manage to do it.

All went wrong with these nasty errors I have shared in my first post, as I have tried to google it and discover that people have more less the same error, or struggling to solve a similar one.

Long story short, you have a very nice answer here how to resolve unmet packages:

How do I resolve unmet dependencies after adding a PPA?

My mistake was that I have made duplicated repository, and the answer in this link solved that, this command sudo apt-get install -f just made another error, you must do this manually, at least I did it (read to the section Preventive Measures, but you could read to the end, it is an imba post).

Second I manage to google this post from official PostgreSQL page http://www.postgresql.org/message-id/20140327084212.GA12703@msgid.df7cb.de (this is the error people usually have when they are struggling with installation of postgresql), this led me to
https://wiki.postgresql.org/wiki/Apt, this is the proper way for adding PostgreSQL Packages to your system, just read it and do it step by step.

Third step are series of commands provided in the @vembutech post:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install postgresql-9.3 postgresql-contrib-9.3
share|improve this answer

Try by installing the with below command.

sudo apt-get install postgresql-common=151.pgdg12.4+1

sudo apt-get install postgresql-9.3 postgresql-contrib-9.3
share|improve this answer
1  
"E: Version '151.pgdg12.4+1' for 'postgresql-common' was not found", error again... – PetarP Dec 19 '14 at 12:44
    
I manage to do it, I run second command and finally I did it, @vembutech <3 – PetarP Dec 19 '14 at 12:49

protected by Byte Commander Sep 16 '16 at 23:43

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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