您的位置:首页 > 数据库

安装 pgdg 源中的 PostgreSQL 9.2

2013-04-18 00:00 609 查看
Ubuntu 12.04 中只提供了 PostgreSQL 8.4 和 9.1,查到 PostgreSQL 项目自己就提供 Debian 和 Ubuntu 的源,而且提供 8.3, 8.4, 9.0, 9.1 和 9.2 共五个版本的,真贴心。:-)

照着步骤走下来,试图安装未遂:

$ apt-get install postgresql-9.2

错误是:

The following packages have unmet dependencies:
postgresql-9.2 : Depends: postgresql-client-9.2 but it is not going to be installed
Depends: postgresql-common (>= 135~) but 129ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.

有些莫名其妙。搜也搜不到相关内容,就好像别人完全没有类似的错误一般。跑上人家的 IRC channel: #postgresql-apt @ irc.freenode.net 去询问,让我给出

$ apt-cache policy postgresql-common

命令的输出结果。哈,我一看,原来原因在此:

postgresql-common:
Installed: (none)
Candidate: 129ubuntu1
Version table:
141.pgdg12.4+1 0
500 http://apt.postgresql.org/pub/repos/apt/ precise-pgdg/main amd64 Packages
129ubuntu1 0
900 http://mirrors.163.com/ubuntu/ precise-updates/main amd64 Packages
129 0
900 http://mirrors.163.com/ubuntu/ precise/main amd64 Packages

我用 salt 配置的 vagrant vm 中有这个一个 apt preference config

# /etc/apt/preferences.d/99local

Package: *
Pin: release n=precise
Pin-Priority: 900

以前没有注意到这个文件的作用,原来是它把 precise 官方包的 priority pin 成了 900,而缺省值是 500,因此导致 postgresql-common version 141 被 version 129 抢先了。

作者:czhang

原文链接:http://czhang.writings.io/articles/d80ab740
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息