Installing PostgreSQL 9.4 On Ubuntu 14.04

By:   –  Last updated:   –  #postgresql ·  #ubuntu

Code Theme [Dark]

Content Overview [Hide]

PostgreSQL 9.4 has many awesome new features, especially its support for jsonb data format. Unfortunately there is no 9.4 packages by default in apt repository of Ubuntu 14.04 LTS. We have to install PostgreSQL 9.4 on Ubuntu 14.04 via PostgreSQL their own repository.

Fisrt of all, create a new apt repository entry file under /etc/apt/sources.list.d.

$ sudo touch /etc/apt/sources.list.d/pgdg.list

The new list file name is not sensitive, but make sure the file extension is .list.

Secondly, add the offical repository to the new source list file. Copy following line and paste it into pgdg.list file created above.

# postgresql official package repository
deb trusty-pgdg main

Or, just execute following command to append the repository to the new source list file.

$ echo "deb trusty-pgdg main" >> /etc/apt/sources.list.d/pgdg.list

Then import the accessing GPG key for this repository.

$ wget --quiet -O - | \
  sudo apt-key add -

Update the packages information:

$ sudo apt-get update

Now is ready to install PostgreSQL 9.4 by apt.

$ sudo apt-get install postgresql-9.4

All steps complete!