系统详情:‌
‌操作系统‌:CentOS Linux 8.5
‌内核版本‌:4.18.0-348.7.1.el8_5.x86_64
‌架构‌:x86_64(64位)
‌系统类型‌:GNU/Linux
问题:在已经安装好PostgreSQL数据库和PostGIS扩展的情况下,想新增加pgrouting15,报如下错误:

[root@node16 ~]# dnf install pgrouting_15
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
emqx_emqx                                                                                                                                                                                             24  B/s | 833  B     00:35    
emqx_emqx-source                                                                                                                                                                                      84  B/s | 833  B     00:09    
PostgreSQL 12 for RHEL / Rocky / AlmaLinux 8 - x86_64                                                                                                                                                251  B/s | 146  B     00:00    
Errors during downloading metadata for repository 'pgdg12':
  - Status code: 404 for https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-8-x86_64/repodata/repomd.xml (IP: 199.232.115.52)
错误:为仓库 'pgdg12' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

解决:
1:彻底清理旧 PostgreSQL 仓库

# 删除所有 pgdg 相关的旧仓库文件
sudo rm -f /etc/yum.repos.d/pgdg-*.repo

会删除系统中所有可能存在的、过时的 PostgreSQL 官方仓库文件。这会永久解决 “Status code: 404 for ... /pgdg12/...” 的错误。
2:配置正确且通用的 PostgreSQL 15 和 pgRouting 仓库

# 安装通用的 PostgreSQL 官方仓库配置
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

3:禁用系统自带的过时 PostgreSQL 模块,防止冲突,根据系统情况可跳过,不执行

# 禁用系统自带的过时 PostgreSQL 模块(防止冲突)
sudo dnf -qy module disable postgresql

4:安装 pgRouting 15

# 安装 pgRouting 15(会连带安装 PostGIS 等依赖)
sudo dnf install -y pgrouting_15

完成所有清理和配置后,安装将顺利进行。

备注:

# 列出所有与 PostgreSQL 相关的可用模块及其状态
sudo dnf module list postgresql
# 启用系统自带的过时 PostgreSQL 模块
sudo dnf -qy module enabled postgresql

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐