配置yum源遇到的问题

零  配置环境

centos  

一 遇到的问题

问题一: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

解决方法:

cd /etc/yum.repos.d vi CentOS-Base.repo :%s/$releasever/7/g #将文件中$releasever全部改成7 yum clean all && yum makecache # 清除和缓存

其中$releasever 是获取你centos的版本号的,例如我的centos的版本号为6.7,获取到的为6,但是已经找不到了,所以直接全局改成7即可。

问题二:提示No more mirrors to try

Error Downloading Packages: binutils-2.27-44.base.el7.x86_64: failure: Packages/binutils-2.27-44.base.el7.x86_64.rpm from base: [Errno 256] No more mirrors to try.

解决方法:重新下载

问题三:Public key for glibc-common-2.17-317.el7.x86_64.rpm is not installed

解决方法:

1 导入GPG keys:

#rpm -- import /etc/pki/rpm-gpg/PRM-GPG-KEY -*

2 修改yum源文件,跳过gpg check(不推荐)

把repo文件设置为gpgcheck =0

使用yum install时加上参数 -no gpgcheck

3 下载最新签名(推荐)

cd /etc/pki/rpm-gpg
wget http://mirrors.163.com/centos/RPM-KEY-CentOS-6
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

问题四:ERROR with rpm_check_debug vs depsolve

ERROR with rpm_check_debug vs depsolve:

/sbin/new-kernel-pkg is needed by (installed) kernel-2.6.32-431.el6.x86_64

/sbin/new-kernel-pkg is needed by (installed) kernel-2.6.32-431.el6.x86_64

You could try running: rpm -Va --nofiles --nodigest

Your transaction was saved, rerun it with: yum load-transaction /tmp/yum_save_tx-2020-12-24-08-20xUyYyL.yumtx

 解决方法:待补充

二 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

 Centos-6

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

Centos-7

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

Centos-8

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

三  yum源的常用操作命令

1 清理缓存:yum clean all

2 生成新缓存:yum makecache

3 执行yum更新:yum update

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值