cd /etc/yum
cd /etc/yum.repos.d/
![①](https://i-blog.csdnimg.cn/blog_migrate/f2e5c4e0f8e63c991c1b32b21f50373e.webp?x-image-process=image/format,png)
①
备份原始的yum源
mv CentOS-Base.repo CentOS-Base.repo.bak
![②](https://i-blog.csdnimg.cn/blog_migrate/36d64de470b4594b74e56fff12b3cf8d.webp?x-image-process=image/format,png)
②
下载yum文件,替代我们刚才备份的那个原始yum源
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
![③](https://i-blog.csdnimg.cn/blog_migrate/e71bbe314a0cc1412ac344be3eae85a9.webp?x-image-process=image/format,png)
③
这两条命令主要是清除和生成新的缓存
![④清除](https://i-blog.csdnimg.cn/blog_migrate/0ece6fdf54c1becf11444c61cf6263e3.webp?x-image-process=image/format,png)
④清除
![⑤新缓存](https://i-blog.csdnimg.cn/blog_migrate/4d34fde06b85cdaf7651a35e5db75679.webp?x-image-process=image/format,png)
⑤新缓存
如果遇到错误
![错误1:没有网络](https://i-blog.csdnimg.cn/blog_migrate/f65dead3041779d9c5987b0af08c02fb.webp?x-image-process=image/format,png)
错误1:没有网络
![原因1:重启网卡但失败](https://i-blog.csdnimg.cn/blog_migrate/93f04af896082845d662035e6cd9f1c2.webp?x-image-process=image/format,png)
原因1:重启网卡但失败
![查看重启网卡失败原因](https://i-blog.csdnimg.cn/blog_migrate/008d53c1bbc2025d7c153d5ce71f4e7e.webp?x-image-process=image/format,png)
查看重启网卡失败原因
解决:
systemctl stop NetworkManager
systemctl disable NetworkManager
重新启动网络:
systemctl start network.service
![解决](https://i-blog.csdnimg.cn/blog_migrate/05b84fac12d5985e88d07ea6e0085b0d.webp?x-image-process=image/format,png)