cd /etc/yum
cd /etc/yum.repos.d/
![①](https://upload-images.jianshu.io/upload_images/9987057-0e87353fdeba89c3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
①
备份原始的yum源
mv CentOS-Base.repo CentOS-Base.repo.bak
![②](https://upload-images.jianshu.io/upload_images/9987057-af254de1c44cbe5d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
②
下载yum文件,替代我们刚才备份的那个原始yum源
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
![③](https://upload-images.jianshu.io/upload_images/9987057-17cd853d19f91af4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
③
这两条命令主要是清除和生成新的缓存
![④清除](https://upload-images.jianshu.io/upload_images/9987057-7906ce3ca3dc4c78.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
④清除
![⑤新缓存](https://upload-images.jianshu.io/upload_images/9987057-fcdf1b0fed39351a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
⑤新缓存
如果遇到错误
![错误1:没有网络](https://upload-images.jianshu.io/upload_images/9987057-3ed69901f7e07694.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
错误1:没有网络
![原因1:重启网卡但失败](https://upload-images.jianshu.io/upload_images/9987057-2c4bd7b94bc76bbd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
原因1:重启网卡但失败
![查看重启网卡失败原因](https://upload-images.jianshu.io/upload_images/9987057-79339c8c8aa91252.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
查看重启网卡失败原因
解决:
systemctl stop NetworkManager
systemctl disable NetworkManager
重新启动网络:
systemctl start network.service
![解决](https://upload-images.jianshu.io/upload_images/9987057-c70dbf7d89f76c20.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)