yum update 正在尝试其他镜像

换国内的阿里云yum源

复制代码
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

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

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

 

之后运行yum makecache生成缓存
[root@web02 ~]# yum clean all && yum makecache

就可以了

 

解决方法:

在网上找方法,大部分都是说,提醒那个错误,是因为网速慢,需要配置yum源,改为国内的就可以了,

(1)备份原有的镜像文件:

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

(2)下载163或阿里云的镜像

163的centos7的镜像(如果你的系统是centos6,地址中的CentOS7改为CentOS6)

wget -cO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

或者使用阿里云的镜像(如果你的系统是centos6,地址中的Centos7改为Centos6)

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

(3)生成新镜像缓存

yum clean all
yum makecache

扩展:

  如果网速还是很慢,还是提示“正在尝试其他镜像”,尝试改变网络设置试试:

  如果虚拟机配置的是静态地址,可以尝试改为动态地址,

1、设置为动态获取地址,cd /etc/sysconfig/network-scripts,将ifcfg-enp0s...这个文件的BOOTPROTO=static修改为dhcp。

2、虚拟机设置里的【网络】,设置为网络地址转换【NAT】。

再次执行

yum clean all

yum makecache

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

风清扬逍遥子

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

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

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

打赏作者

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

抵扣说明:

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

余额充值