centos7 更换yum源
1、清空原YUM源配置文件
cd /etc/yum.repos.d
rm -rf *
2、下载阿里yum源配置文件
wget https://mirrors.aliyun.com/repo/Centos-7.repo
有可能wget命令也没有可以用curl
curl 'https://mirrors.aliyun.com/repo/Centos-7.repo'>Centos-7.repo
3、修正YUM配置文件
vi Centos-7.repo
替换掉$releasever,在vim(或vi)的命令模式下输入(下一行整体复制)
:% s/$releasever/7/g
把整个文件下的$releasever替换为7。
4、清除YUM的缓存,更新缓存
yum clean all
yum makecache
5、测试
yum install -y httpd
评论