将Centos的默认yum源更换为阿里云源

因为CentOS的默认yum源可能不是国内的源,所以使用yum命令去安装或更新某些东西时会变得很慢。这时候就需要将yum源更换为国内的镜像站点。
这里参考的是这篇博客:

https://blog.csdn.net/inslow/article/details/54177191





将CentOS的yum源改为阿里云镜像源

  1. 备份系统自带的yum源

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup




2. 下载阿里云的yum源到 /etc/yum.repos.d/

CentOS7

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


CentOS6

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


CentOS5

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo




3. 运行yum makecache生成缓存

[root@localhost ~]# yum makecache




4. 看到如下信息就说明yum已经成功更新了!

[root@localhost ~]# yum -y update
已加载插件:fastestmirror, refresh-packagekit, security
设置更新进程Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com





报错

如果你也出现了下图一样的问题,请参考这篇博客

https://www.cnblogs.com/Trees/p/7497268.html

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值