![无法安装 PostrgreSQL 9.6 - 无法通过 glob 'postgresql-9.6' 找到任何包](https://linux22.com/image/1192125/%E6%97%A0%E6%B3%95%E5%AE%89%E8%A3%85%20PostrgreSQL%209.6%20-%20%E6%97%A0%E6%B3%95%E9%80%9A%E8%BF%87%20glob%20'postgresql-9.6'%20%E6%89%BE%E5%88%B0%E4%BB%BB%E4%BD%95%E5%8C%85.png)
鉴于
Ubuntu 22.04
我尝试像这样安装 PostgreSQL 9.6(我需要这个版本):
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.6
但出现错误:
sudo apt-get install postgresql-9.6
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package postgresql-9.6
E: Couldn't find any package by glob 'postgresql-9.6'
E: Couldn't find any package by regex 'postgresql-9.6'
使用评论中的建议后我收到错误:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
postgresql-9.6 is already the newest version (9.6.24-3.pgdg22.04+1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
答案1
您需要添加来自 Postgres 的存储库,因为这些版本不在 Ubuntu 存储库中。
首先,导入 GPG 密钥。
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
接下来,添加 repo。
echo "deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
然后您就可以安装您想要的版本了。
sudo apt update
sudo apt install postgresql-9.6