Install PostgreSQL From Its Official Repository in Ubuntu 14.04

Last updated: February 17, 2014

This simple tutorial is going to show beginners how to install the PostgreSQL 9.3 (9.2, 9.1, 9.0 or 8.4) in Ubuntu 14.04 Server via its official repository.

The PostgreSQL Global Development Group (PGDG) maintains an APT repository of PostgreSQL packages for Debian and Ubuntu. The repository provides the PostgreSQL server packages as well as extensions and modules packages for all PostgreSQL versions supported.

So far, the repository support:

  • Debian 6.0 (squeeze), 7.0 (wheezy), and unstable (sid) 64/32 bit (amd64/i386)
  • Ubuntu 10.04 (lucid), 12.04 (precise), and 14.04 (trusty) 64/32 bit (amd64/i386)
  • PostgreSQL 8.4, 9.0, 9.1, 9.2, 9.3
  • Server extensions such as Slony-I, various PL languages, and datatypes
  • Applications like pgadmin3, pgbouncer, and pgpool-II

To get started installing PostgreSQL on Ubuntu 14.04, do the following steps:

1. Create and edit the PostgreSQL repository by running the command below:

sudo vi /etc/apt/sources.list.d/pgdg.list

Press I on keyboard and add the below line into the file:

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

Press Esc on keyboard and followed by :wq to save the file.

2. Download & import the repository key:

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

3. Update your system:

sudo apt-get update && sudo apt-get upgrade

4. Now you’re able to install PostgreSQL via below command:

sudo apt-get install postgresql-9.3 pgadmin3

NOTE: This repository provides “postgresql”, “postgresql-contrib”, and “postgresql-client” meta-packages that depend on the latest postgresql-x.y, … packages, similar to the ones present in Debian and Ubuntu. Once a new PostgreSQL version is released, these meta-packages will be updated to depend on the new version. If you rather want to stay with a particular PostgreSQL version, you should install specific packages like “postgresql-9.3” instead of “postgresql”.

via:postgresql wiki page

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via ubuntuhandbook1@gmail.com Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |

7 responses to Install PostgreSQL From Its Official Repository in Ubuntu 14.04

  1. Thanks a LOT for this tutorial… the only one that really worked for me!

  2. After going through many blog for installing postgresql I got this..and its work perfectly for me…cool

  3. While executing 3rd step, I gave ‘y’ to question asked as , “after this 16 GB additional disk is uesd, do you want to continue?[Y/N]”. Then it displayed as “Abort”.
    I anyway proceeded and did the fourth one too. Nothing is installed in my system. What is the problem? Can someone reply soon please.

    • Hy mitra, jus try again as sometimes ubuntu apt doesn’t recognize y – i think it’s a bug, just run the command again and it will work!

  4. Hi Ji m,
    thank you for your installation description. It is the second one which I tried and yours worked fine.

  5. ZARAN HIRACHAND DHULLA February 27, 2016 at 11:38 am

    i am trying to install CYBEROAM IVIEW on Ubuntu 14.04

    i have Postgresql 9.5 version, but “iView” requires 8.4 version.

    how do i install 8.4 in Ubuntu 14.04.

    or make iView work with 9.5 version.

    Kindly guide.