推荐在Ubuntu上使用PostgreSQL社区的apt repository,默认的repo会存在升级问题

经常使用Ubuntu操作系统的用户们都清楚,在所有Ubuntu版本的软件仓库中,都有默认的PostgreSQL数据库,但是这些PG数据库的版本往往都不是最新发布的版本,如果您想使用一些新版本才有的功能,可能安装并不会很顺利。这也是本文的初衷,推荐大家在Ubuntu上使用PostgreSQL社区提供的apt repository。

关于PostgreSQL Apt Repository

上面已经提到了,如果当前Ubuntu软件仓库提供的PG数据库版本并不是您想要的版本,这时候您可以考虑使用PostgreSQL Apt Repository。这个软件仓库可以与您当前使用的Ubuntu系统及保管理工具完美的继承,并提供PostgreSQL大部分版本的完美升级支持。(使用默认仓库,有时候会遇到系统升级导致的数据库升级失败问题)。

当前PostgreSQL Apt Repository支持的Ubuntu版本有:

  • impish (21.10)
  • hirsute (21.04)
  • focal (20.04)
  • bionic (18.04)

支持的架构有:

  • amd64
  • arm64 (18.04 and newer; LTS releases only)
  • i386 (18.04 and older)
  • ppc64el (LTS releases only)

如何添加并使用PostgreSQL Apt Repository

如果要增加PostgreSQL官方的apt仓库,可以遵照以下步骤:

# 创建文件仓库配置
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg ma
# 添加官方源(如前所述) curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | \ sudo gpg --dearmor -o /usr/share/keyrings/postgresql-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/postgresql-archive-keyirng.gpg] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | \ sudo tee /etc/apt/sources.list.d/pgdg.list sudo apt update sudo apt install -y postgresql-16 deb [signed-by=/usr/share/keyrings/postgresql-archive-keyirng.gpg] http://apt.postgresql.org/pub/repos/apt focal-pgdg main Hit:1 http://mirrors.tencentyun.com/ubuntu focal InRelease Hit:2 http://mirrors.tencentyun.com/ubuntu focal-updates InRelease Hit:3 http://mirrors.tencentyun.com/ubuntu focal-backports InRelease Hit:4 http://mirrors.tencentyun.com/ubuntu focal-security InRelease Hit:5 https://download.docker.com/linux/ubuntu focal InRelease Hit:6 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease Hit:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0 InRelease Ign:8 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease Err:9 http://apt.postgresql.org/pub/repos/apt focal-pgdg Release 404 Not Found [IP: 198.18.0.12 80] Hit:10 https://packages.redis.io/deb focal InRelease Reading package lists... Done E: The repository 'http://apt.postgresql.org/pub/repos/apt focal-pgdg Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package postgresql-16
最新发布
11-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿福Chris

你的鼓励是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值