第一步:下载镜像源
这里给出几个镜像源的地址
镜像源 | 地址 |
---|---|
中科大镜像源 | http://mirrors.ustc.edu.cn/help/centos.html |
阿里镜像源 | http://mirrors.aliyun.com/repo/Centos-7.repo |
163镜像源 | http://mirrors.163.com/.help/CentOS7-Base-163.repo |
第二步:配置rhel7的网络yum源
这里将下载的镜像源命名为base.repo
方法一:修改配置文件
运行如下命令:
sed -i 's/$releasever/7/g' /etc/yum.repos.d/base.repo
方法二:替换yum相关包
搜索
rpm -aq | grep yum
卸载
rpm -aq | grep yum | xargs rpm -e --nodeps
下载并安装
rpm -ivh yum-*
第三步:更新
yum clean all
yum makecache
第四步:检测
yum list
看到一堆列表刷到屏幕上就说明yum源替换成功了。