CentOS 7如何更换yum本地源为阿里云yum源?

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zqq_2016/article/details/87260325

小插曲:

阿里云官方yum源:https://yq.aliyun.com/articles/675241?spm=a2c4e.11155472.0.0.75eb40c8e9drNV

检查是否安装yum包,以及有哪些yum包

[root@localhost~]# rpm -qa |grep yum

更改yum源为阿里云yum源:

1.备份源文件:

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

 

2.下载阿里云yum源安装文件:

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

 

查看CentOS-Base.repo文件后发现,文件中出现$releasever(centos版本为7)

编辑配置文件(所有的$releasever均替换为7):

[root@localhost ~]# cd /etc/yum.repos.d

[root@localhost yum.repos.d]# sed -i 's/$releasever/7/g'  CentOS-Base.repo

 

3.清除原有yum缓存 yum clean all

4.生成缓存 yum makecache

扫描二维码关注公众号,回复: 5180489 查看本文章

猜你喜欢

转载自blog.csdn.net/zqq_2016/article/details/87260325