准备:
需要提前下载一个wget,便于后面操作
yum install -y wget
- 备份原镜像文件,便于后期恢复
$sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.下载新的CentOS-Base.repo 到/etc/yum.repos.d/
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- 清除缓存
yum clean all
4、清除YUM的缓存,更新缓存
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
5、测试
[root@localhost yum.repos.d]# yum install -y wget