记录CentOS 6、CentOS 7、CentOS 8 更换阿里云源

一般我们选择到的海外云服务器,默认都是海外的源,如果yum安装软件的时候要么不好安装,要么速度慢,所以一般我们会去更换阿里云源的,这里我们如何更新呢?这里我们可以用到CentOS 6、CentOS 7、CentOS 8 常见的三个系统镜像。

1、备份

将 CentOS-Base.repo 为CentOS-Base.repo.backup

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

2、下载源

下载新的 http://mirrors.aliyun.com/repo/Centos-7.repo,并命名为CentOS-Base.repo。

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

3、清理缓存

yum clean all     # 清除系统所有的yum缓存
yum makecache     # 生成yum缓存

4、更新源

yum update -y

 

投上你的一票

本文出处:老蒋部落 » 记录CentOS 6、CentOS 7、CentOS 8 更换阿里云源 | 欢迎分享( 公众号:老蒋朋友圈 )

公众号 「老蒋朋友圈」获取站长新知 / 加QQ群 【1012423279】获取商家优惠推送