Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to install PostgreSQL in Ubuntu 13.04?

I followed by this tutorial, How to install postgreSQL 9-2 -

But in logs it says:

the package is deprecated and no longer will be used

So, what is the package name for the latest postgres? keyring? it doesn't work if it is "keyring".

share|improve this question
up vote 16 down vote accepted

As your log describes the package is deprecated. But more specifically it has moved. From the PPA owner's page:

In about a year (during Ubuntu 12.04 LTS's life time, but after 12.10 is end-of-life) this PPA is going to be deprecated. Please consider moving to soon.

I had issues upgrading to 13.04 with PostgreSQL 9.2 installed on my 12.10 (as described here). This resulted in me unistalling PostgreSQL 9.2 and upgrading. If you also have this issue, back-up your database or it will be lost when uninstalled.

After the upgrade, I uncommented the PostgreSQL repo in /etc/apt/sources.list.d/pgdg.list and ran:

sudo apt-get update

If you don't already have the PostgreSQL repo added, you should follow these instructions, with the exception that there is not a package for Raring (13.04) yet. Just use Precise.

For reference, my pgdg.list file looks like:

deb precise-pgdg main 

And running the update, I can see it getting PostgreSQL 9.2 from the precise package (Whereas, other updates are raring):

Get:5 precise-pgdg Release.gpg [836 B]
Get:7 precise-pgdg Release [25.6 kB]
Get:10 precise-pgdg/main amd64 Packages [27.6 kB]
Get:14 precise-pgdg/main i386 Packages [27.6 kB]
Ign precise-pgdg/main Translation-en_US
Ign precise-pgdg/main Translation-en

Running psql --version to confirm this, the terminal outputs:

psql (PostgreSQL) 9.2.4
share|improve this answer
Don't expect an official package for non-LTS Raring. From the PG wiki: "We chose to support only the LTS (long term support) releases of Ubuntu because otherwise we'd need to support too many distributions in parallel. Generally, you can use the packages from the LTS release that predates your release, i.e. on raring (13.04), you would use precise-pgdg (12.04)." – Iain Elder Nov 24 '13 at 17:36

You need to run something to resolve the postgresql-common conflict in short with the following (read only the bottom if you just want it to work and don't care why)

The long winded reason. Basically the 3rd party postgresql-common (build 141+) says it Breaks: logrotate (>= 3.8). The included ubuntu postgresql-common package (build 140) does not have this problem. postgresql-9.2 only requires a build of 135 or greater of postgresql-common. By running the following commands. This will specify a repository to get postgresql-common from, which in this case the ubuntu provided package of build 140 of postgresql-common while using the 3rd party apt repo to install Postgresql-9.2

Follow these instructions installing the precise sources repo:

Create /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg. In the example, replace squeeze with the actual distribution you are using:

deb precise-pgdg main

(You may determine the codename of your distribution by running lsb_release -c.) Import the repository key from, update the package lists, and start installing packages:

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

Commands to run if you once you have the apt

sudo apt-get update
sudo apt-get install postgresql-common -t raring
sudo apt-get install postgresql-9.2
share|improve this answer
This did it for me – nvrs May 2 '13 at 7:43

I tried to install postgresql-9.2 by following tutorial on postgresql wiki. Unfortunately there are no packages for raring distribution yet.
When I tried to install package for older distribution (precise) I got conflicts with other packages that I couldn't resolve.

The only solution I found is to install older version (postgresql-9.1) by:

sudo apt-get install postgresql
share|improve this answer
I also had to choose 9.1. – y0mbo Oct 15 '13 at 20:32

You don't have to do anything special if you just want the latest Ubuntu-packaged PostgreSQL: apt-get install postgresql does the trick.

If you need the features of the very latest release (9.2 instead of 9.1), however, you need to add the repository.

share|improve this answer
Except that they don't support Raring at this time. – Daniel C. Sobral Aug 6 '13 at 16:35

try this:

wget --quiet -O - | sudo apt-key add -
sudo sh -c 'echo "deb precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
sudo apt-get update
sudo apt-get install postgresql-9.3 pgadmin3

It worked well for me.

Source: How to: Install PostgreSQL 9.3 on Ubuntu – Complete Guide

share|improve this answer

Sometimes it pays off being half asleep... :-)

I created /etc/apt/sources.list.d/pgdg.list as described in the wiki link ( in the previous post. But... being half asleep... I did type the this:

deb wheezy-pgdg main 9.3

And it works like a charm. I now have 9.3beta, 9.2.4 and 9.1.9 running.


share|improve this answer
wget --quiet -O - | sudo apt-key add -
sudo sh -c 'echo "deb precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
sudo apt-get update
sudo apt-get install postgresql-9.3 pgadmin3

Es justo lo que necesitaba para instalar postgresql-9.1 en ubuntu 14 gracias

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.