Alibaba Cloud Linux 系统上安装 Postgresql 数据库报错 repodata/repomd.xml Status code: 404

# 01.Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# 02.Install PostgreSQL:
sudo yum install -y postgresql12-server

# 03.Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl enable postgresql-12
sudo systemctl start postgresql-12


执行第二步时,报错:

Errors during downloading metadata for repository 'pgdg-common':
  - Status code: 404 for https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-3-x86_64/repodata/repomd.xml 
Error: Failed to download metadata for repo 'pgdg-common': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

解决方式:

# 在以下目录找到 pg 的repo。复制其名称,例如:pgdg-redhat-all.repo
ls -l /etc/yum.repos.d/

# 将刚刚复制的repo 名称追加到以下文件的include字段中。
vim /etc/yum/pluginconf.d/releasever-adapter.conf 
# 例如
include=docker-ce.repo, epel.repo, pgdg-redhat-all.repo

如果没有 pluginconf.d 目录,则执行如下命令:
dnf install dnf-plugin-releasever-adapter --repo alinux3-plus

  • 10
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值