安裝 pgdg 源中的 PostgreSQL 9.2

Ubuntu 12.04 中只提供了 PostgreSQL 8.4 和 9.1,查到 PostgreSQL 項目本身就提供 Debian 和 Ubuntu 的源,並且提供 8.3, 8.4, 9.0, 9.1 和 9.2 共五個版本的,真貼心。:-) node

照着步驟走下來,試圖安裝未遂: sql

$ apt-get install postgresql-9.2

錯誤是: ubuntu

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 去詢問,讓我給出 post

$ apt-cache policy postgresql-common

命令的輸出結果。哈,我一看,原來緣由在此: .net

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 vagrant

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

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

之前沒有注意到這個文件的做用,原來是它把 precise 官方包的 priority pin 成了 900,而缺省值是 500,所以致使 postgresql-common version 141 被 version 129 搶先了。 postgresql


做者:czhang code

原文連接:http://czhang.writings.io/articles/d80ab740 ci

相關文章
相關標籤/搜索