如何使用 APT 安装旧版本的 Postgres?

Bor*_*itz 5 postgresql ubuntu apt

我正在使用 Kubuntu 16.04LTS。我想安装 Postgres 9.3(当前版本是 9.5,这是主存储库中的版本)。

9.3 版的 .deb 文件可在http://packages.ubuntu.com/trusty/postgresql-9.3 获得,但如果可能的话,我想通过 APT。我试过了

$ sudo apt-get install postgresql=9.3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '9.3' for 'postgresql' was not found
Run Code Online (Sandbox Code Playgroud)

(与postgresql=9.3.11-0ubuntu0.14.04)和

$ sudo apt-get -t=14.04 install postgresql
Reading package lists... Done
E: The value '14.04' is invalid for APT::Default-Release as such a release is not available in the sources
Run Code Online (Sandbox Code Playgroud)

(因为 9.3 是 14.04 存储库中的最新版本)。

我已经查找了有关这些错误消息的信息,但找不到任何有用的信息。如何使用 APT 安装旧版本的 Postgres?

Dan*_*ité 5

可以在较新的 Ubuntu 系统上安装旧版本的 PostgreSQL,但 Ubuntu 提供的软件包不支持。对于旧版 Ubuntu 上的新版 PostgreSQL 也是如此。

使用任何版本的最简单解决方案是切换到PostgreSQL 包的PGDG APT存储库,该存储库由 PostgreSQL 开发组维护。

请注意不要混合 Ubuntu 和 PGDG 存储库之间的内容,因为软件包共享相同的名称。通常,您需要首先清除已安装的postgresql*软件包libpq*,以便于进行干净且完整的切换。