0

In our test machine(ubuntu lucid) ,we had postgres8.3 and postgres8.4 installed by a previous team.

They are at

/etc/postgresql
              /8.3
              /8.4

and our django apps were using postgres8.3 as the database.Now ,the client wants to use postgres 9.2.So we tried to install it

sudo apt-get install postgresql

but I am getting

1 upgraded, 0 newly installed, 0 to remove and 40 not upgraded
...
Setting up postgresql (8.4.16-0ubuntu10.04) ...

How do I install postgres 9.2 ? and remove the older versions? Will the existing db used by our app get removed?

4

1 回答 1

0

I would suggest to add ppa:pitti/postgresql repostitory using command:

sudo apt-add-repository ppa:pitti/postgresql

After that you can install newer PostgreSQL using

sudo apt-get update
sudo apt-get install postgresql-9.2

Also, recently there was created new PostgreSQL Apt Repository for Ubuntu/Debian, which is supported by PostgreSQL project - you can use this one as well.

Newly installed PostgreSQL package will not touch or migrate your old data, and it will use port different from default 5432. You might be able to use pg_upgrade for it, but it may not work to upgrade from very old versions.

Safe, but slow approach to upgrade your data is to pg_dump data from old database, and pg_restore into new one. Be sure to always use new pg_dump binary, even when connecting to old server.

于 2013-02-20T06:00:54.227 回答