Ubuntu 12.04 中只提供了 PostgreSQL 8.4 和 9.1,查到 PostgreSQL 项目,而且提供 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 installedE: 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
我用 配置的 vm 中有这个一个 apt preference config
# /etc/apt/preferences.d/99localPackage: *Pin: release n=precisePin-Priority: 900
以前没有注意到这个文件的作用,原来是它把 precise 官方包的 priority pin 成了 900,而缺省值是 500,因此导致 postgresql-common version 141 被 version 129 抢先了。
作者:
原文链接: