yum update 更新报错,在使用yum时failed

错误信息如下:

解决方案:

1、检查机器是否链接外网

ping www.baidu.com

 2、查看防火墙状态,并暂时关闭防火墙。

systemctl status firewalld
systemctl stop firewalld

 

3、备份当前yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

4、安装新的yum源(下载国内yum源配置文件到/etc/yum.repos.d/CentOS-Base.repo)

  1. 阿里云 CentOS 7 源(推荐):

  2. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  3. 网易163 CentOS 7 源:

  4. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

  5. 搜狐 CentOS 7 源:

  6. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.sohu.com/help/CentOS7-Base-sohu.repo

  7. 华为云 CentOS 7 源:

  8. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.myhuaweicloud.com/repo/CentOS-7.repo

  9. 华东理工大学 CentOS 7 源:

  10. wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.ustc.edu.cn/centos/7/os/x86_64

  11. 清华大学 CentOS 7 源:

  12. wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/

  13. 北京理工大学 CentOS 7 源:

  14. wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.bfsu.edu.cn/centos/7/os/x86_64/

  15. 上海交通大学 CentOS 7 源:

  16. wget -O /etc/yum.repos.d/CentOS-Base.repo https://ftp.sjtu.edu.cn/centos/7/os/x86_64/

  17. 中国科学技术大学 CentOS 7 源:

  18. wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.ustc.edu.cn/centos/7/os/x86_64/

  19. 兰州大学 CentOS 7 源:

  20. wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirror.lzu.edu.cn/centos/7/os/x86_64/

5、以阿里云源为例:

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

 6、清理老版本yum源,并更新新的yum源

yum clean all
yum makecache

 

 

至此-以上完成yum源转换,并解决了yum无法使用。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值