18

How to install PostgreSQL in Ubuntu 13.04?

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

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

8 Answers 8

26

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 http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main

(You may determine the codename of your distribution by running lsb_release -c.) Import the repository key from http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc, update the package lists, and start installing packages:

wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | 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
1
  • This did it for me
    – nvrs
    May 2, 2013 at 7:43
16

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 apt.postgresql.org 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 http://apt.postgresql.org/pub/repos/apt/ 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 http://apt.postgresql.org precise-pgdg Release.gpg [836 B]
Get:7 http://apt.postgresql.org precise-pgdg Release [25.6 kB]
Get:10 http://apt.postgresql.org precise-pgdg/main amd64 Packages [27.6 kB]
Get:14 http://apt.postgresql.org precise-pgdg/main i386 Packages [27.6 kB]
Ign http://apt.postgresql.org precise-pgdg/main Translation-en_US
Ign http://apt.postgresql.org precise-pgdg/main Translation-en

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

psql (PostgreSQL) 9.2.4
1
  • 1
    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)." Nov 24, 2013 at 17:36
6

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
1
  • I also had to choose 9.1.
    – y0mbo
    Oct 15, 2013 at 20:32
3

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 apt.postgresql.org repository.

1
  • Except that they don't support Raring at this time. Aug 6, 2013 at 16:35
3

try this:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ 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

2

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

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

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

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

:-)

0
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ 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

0

You can also install postgresql on ubuntu like this:

# curl -s https://anonscm.debian.org/cgit/pkg-postgresql/postgresql-common.git/plain/pgdg/apt.postgresql.org.sh | bash
# apt install postgresql-9.2 -y

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .