Linux Mint 21
我尝试像这样安装 postgresql 9.6:
sudo apt-get install postgresql-9.6
但出现错误:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
postgresql-9.6 : Depends: libldap-2.4-2 (>= 2.4.7) but it is not installable
Depends: libssl1.1 (>= 1.1.0) but it is not installable
Recommends: postgresql-contrib-9.6 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
答案1
(*免责声明:我是新手,所以对任何事都要谨慎)
在运行安装并创建“pgdg.list”之前,您是否正确安装了 postgres 证书?
如果没有,请按照以下说明进行操作:
sudo apt install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg
>/dev/null
现在写pgdg.列表文件到/etc/apt/sources.list.d/
sudo nano /etc/apt/sources.list.d/pgdg.list
(我使用了纳米,但您可以随意使用您喜欢的方法)
在文件中写入:
deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main
重要的:将“buster”替换为你的特定发行版名称,你可以通过运行以下命令进行检查:
lsb_release -c
现在保存文件并退出(nano 中按 ctrl+x),您现在应该能够成功安装 postgres:
sudo apt update
sudo apt install postgresql-9.6