PostgreSQL
is available in all Ubuntu versions by default. However, Ubuntu “snapshots” a specific version of PostgreSQL that is then supported throughout the lifetime of that Ubuntu version. Other versions of PostgreSQL are available through the PostgreSQL apt repository, as well as through a PPA (Personal Package Archive – the Ubuntu standard for addon repositories) repository.
Should packages not be available for your distribution, or there are issues with your package manager, there are graphical installers available.
Finally, most Linux systems make it easy to build from source.
Included in distribution
Ubuntu includes PostgreSQL by default. To install PostgreSQL on Ubuntu, use the apt-get (or other apt-driving) command:
# apt-get install postgresql-9.3
The repository contains many different packages including third party addons. The most command and important packages are (substitute the version number as required):
- postgresql-client-9.3 – client libraries and client binaries
- postgresql-9.3 – core database server
- postgresql-contrib-9.3 – additional supplied modules
- libpq-dev – libraries and headers for C language frontend development
- postgresql-server-dev-9.3 – libraries and headers for C language backend development
- pgadmin3 – pgAdmin III graphical administration utility
PostgreSQL Apt Repository
If the version included in your version of Ubuntu is not the one you want, you can use the PostgreSQL Apt Repository. This repository will integrate with your normal systems and patch management, and provide automatic updates for all supported versions of PostgreSQL throughout the support lifetime of PostgreSQL.
The PostgreSQL apt repository supports LTS versions of Ubuntu, 10.04 and 12.04, on amd64 and i386 architectures. While not fully supported, the packages often work on non-LTS versions as well, by using the closest LTS version available.
To use the apt repository, follow these steps:
- Precise 12.04
- 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/ precise-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
For more information about the apt repository, including answers to frequent questions, please see the apt page on the wiki.
Ubuntu PPA
Other versions of PostgreSQL than the standard one for a specific Ubuntu version are available in the PostgreSQL backports PPA repository. To enable this repository, run the command:
sudo add-apt-repository ppa:pitti/postgresql
Once this is done, you can proceed to install and update packages the same way as the ones included in the distribution.
Leave a Reply
You must be logged in to post a comment.