无法安装包 libpq-dev

无法安装包 libpq-dev

我正在使用 ubuntu 12.04。当我尝试安装包时,libpq-dev出现以下错误。

After this operation, 803 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
WARNING: The following packages cannot be authenticated!
  libpq5 libpq-dev
Install these packages without verification [y/N]? y
Err https://apt.postgresql.org/pub/repos/apt/ precise-pgdg/main libpq5 i386 9.6.1-2.pgdg12.4+1
  server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Err https://apt.postgresql.org/pub/repos/apt/ precise-pgdg/main libpq-dev i386 9.6.1-2.pgdg12.4+1
  server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Failed to fetch https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-9.6/libpq5_9.6.1-2.pgdg12.4+1_i386.deb  server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Failed to fetch https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-9.6/libpq-dev_9.6.1-2.pgdg12.4+1_i386.deb  server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
W: Duplicate sources.list entry http://apt.postgresql.org/pub/repos/apt/ precise-pgdg/main i386 Packages (/var/lib/apt/lists/apt.postgresql.org_pub_repos_apt_dists_precise-pgdg_main_binary-i386_Packages)
W: You may want to run apt-get update to correct these problems
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

在谷歌搜索后,我尝试了很多方法,但都没有任何效果。我试过了sudo apt-get updatesudo apt-get install libpq-dev --fix-missing但没有运气。

答案1

必须安装正确且最新的 PGP 公钥才能使用 apt.postgresql.org 存储库。根据错误消息,这似乎是您遇到的问题。

https://wiki.postgresql.org/wiki/Apt有关于如何安装它的说明,基本上是:

sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update

相关内容