Database 更新postgres版本并删除旧版本

Database 更新postgres版本并删除旧版本,database,postgresql,ubuntu,Database,Postgresql,Ubuntu,在我们的测试机器(ubuntulucid)中,我们有前一个团队安装的postgres8.3和postgres8.4 他们在 /etc/postgresql /8.3 /8.4 我们的django应用程序使用postgres8.3作为数据库。现在,客户端想要使用Postgres9.2。所以我们尝试安装它 sudo apt-get install postgresql 但是我越来越 1 upgraded, 0 newly installed

在我们的测试机器(
ubuntulucid
)中,我们有前一个团队安装的
postgres8.3
postgres8.4

他们在

/etc/postgresql
              /8.3
              /8.4
我们的django应用程序使用postgres8.3作为数据库。现在,客户端想要使用Postgres9.2。所以我们尝试安装它

sudo apt-get install postgresql
但是我越来越

1 upgraded, 0 newly installed, 0 to remove and 40 not upgraded
...
Setting up postgresql (8.4.16-0ubuntu10.04) ...
如何安装
postgres 9.2
?并删除旧版本?我们的应用程序使用的现有数据库是否会被删除?

我建议使用以下命令添加repository:

sudo apt-add-repository ppa:pitti/postgresql
之后,您可以使用安装更新的PostgreSQL

sudo apt-get update
sudo apt-get install postgresql-9.2
此外,最近还为Ubuntu/Debian创建了新的应用程序,这是PostgreSQL项目支持的—您也可以使用这个

新安装的PostgreSQL包不会接触或迁移旧数据,它将使用不同于默认5432的端口。您可能可以使用
pg_upgrade
进行升级,但从非常旧的版本升级可能不起作用

升级数据的安全但缓慢的方法是从旧数据库中恢复数据,然后将数据还原到新数据库中。确保始终使用新的
pg_dump
二进制文件,即使在连接到旧服务器时也是如此