centos7配置aliyun的yum源和epel源

一、配置yum的源地址
1、[[email protected] yum.repos.d]#wget http://mirrors.aliyun.com/repo/Centos-7.repo
centos7配置aliyun的yum源和epel源
2、修改$releasever的值
我们获取到的配置文件Centos-7.repo打开后有个$releasever,这个是yum变量,我们需要替换掉,否则源没法使用,如果不替换可以试一下yum的命令查看显示什么就知道了。
根据自己系统版本把$releasever替换为相对应的版本数字。
使用如下命令替换$releasever,
[[email protected] ~]# sed -i 's/$releasever/7/g' /etc/yum.repos.d/Centos-7.repo
3、注释aliyuncs.com
centos-7.repo文件里面有的是使用的是https://mirrors.aliyuncs.com.建议都注释掉,这个地址是用在阿里云服务器内网的,我们自己的电脑不可能链接得到,所以这个我就注释了。
centos7配置aliyun的yum源和epel源
二、epel源
下载epel源
wget https://mirrors.aliyun.com/repo/epel-7.repo
三、最后执行yum makecache生成缓存。
全部注释后,再次执行 yum clean all; yum makecache
centos7配置aliyun的yum源和epel源
centos7配置aliyun的yum源和epel源
上面图片中有几个没有启用,这两个干嘛的就留给大家去百度吧,如果想要开启的话就更改Centos-7.repo文件中的enabled=1就可以了

转载于:https://blog.51cto.com/aixer95/2325505