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”.