16

I'm using Ubuntu 14.04. I'm trying to download postgresql using this guide.

But when I run the command sudo apt-get install postgresql-9.4 in my terminal, I get this error message:

E: Unable to locate package postgresql-9.4
E: Couldn't find any package by regex 'postgresql-9.4'

What am I doing wrong?

Joe Morano
  • 195
  • 1
  • 3
  • 12

2 Answers2

24

You can install postgres 9.4 on Ubuntu 14.04!

Follow the instructions on http://www.postgresql.org/download/linux/ubuntu/:

Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for the repository:

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

Import the repository signing key, and update the package lists:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
  sudo apt-key add -
sudo apt-get update

Now you can install with

sudo apt-get install postgresql-9.4
TimoSolo
  • 341
  • 1
    how do i execute this. coming from a windows noob user. can you give me commands to type line by line in the cmd – noogui Sep 05 '17 at 06:08
  • 1
    @noogui literally just copy paste the above in your terminal. To "create the file" just type sudo touch /etc/apt/sources.list.d/pgdg.list or use a program like vim, nano, or emacs. In that file youve created, just add the one single line starting with deb - that is the location of the postgres package repository. Then just copy the rest of the commands above and paste it into your terminal - it will add the authentication key for your system and that repository. Run the final command above to install the 9.4 package from the repository. – Todd Sep 29 '17 at 15:32
  • This should be the accepted answer, helps users on other platforms such as Debian or other versions of Ubuntu altogether. – Cécile Fecherolle Nov 20 '19 at 13:46
8

That is because in Ubuntu 14.04 repositories there is postgresql-9.3 version. So run

sudo apt-get install postgresql-9.3
Pilot6
  • 90,100
  • 91
  • 213
  • 324
  • I got back "E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)." – Joe Morano May 09 '15 at 21:22
  • So run "sudo apt-get install -f". – Pilot6 May 09 '15 at 21:25
  • Not "sudo apt-get -f install"? – Joe Morano May 09 '15 at 21:26
  • It does not matter. – Pilot6 May 09 '15 at 21:27
  • By the way, I think that the 14.04 version (no LTS) is no longer supported. This answer won't work. On the other hand, today, I installed postgresql-9.4+postgis-2.1 in Debian 8. In my Ubuntu 14.10 it was unfunctional because there are two libgdal versions totally incompatible. If you have the last R version with rgdal it is probable that QGIS will be broken. I experienced that. The same problem with postgres+postgis. – xunilk May 09 '15 at 23:38
  • 14.04 IS LTS. And it is supported till April 2019. – Pilot6 May 10 '15 at 08:11
  • 4
    So what if you want to use the 9.4 version, which actually have the functionality (jsonb) that I need? – Mattis Nov 04 '15 at 13:53
  • this saved my ass. thanks a lot. tried 9.6, 9.4 , 9.2 to no avail. hahaha – noogui Sep 05 '17 at 06:06
  • This should not be the accepted answer. Note what @Mattis said above - 9.4 is required for :jsonb. This answer is basically like "just deal with it, you dont get 9.4" which is in no way helpful to those whom need 9.4

    @TimSolo has the correct answer, which should be accepted.

    – Todd Sep 29 '17 at 14:19