1. 首先備份源檔案
[[email protected] ~]#cd /etc/yum.repos.d/
[[email protected] yum.repos.d]#mv CentOS-Base.repo CentOS-Base.repo.bak
2. 下載下傳163源
[[email protected] yum.repos.d]#wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[[email protected] yum.repos.d]#ls
CentOS7-Base-163.repo CentOS-Base.repo.bak
3. 檢視系統發行版本和系統架構
檢視系統發行版本
[[email protected] yum.repos.d]#cat /etc/ifcos-release
IFCOS release 6.4 (Final)
檢視系統架構
[[email protected] yum.repos.d]#uname -a
Linux ifcos.ifcosdomain 2.6.32-358.23.2.el6.centos.plus.x86_64 #1 SMP Thu Oct 17 00:31:29 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
修改163源檔案中的位址為适合自己系統的位址
在修改之前,可以先通路163源位址http://mirrors.163.com/centos。
由于我的系統發行版本為6.4,而6.4 檔案夾下面沒有東西,點開readme,發現這一版本已經被棄用,可以使用版本6代替6.4,readme檔案如下:
This directory (and version of CentOS) is deprecated. For normal users,
you should use /6/ and not /6.4/ in your path. Please see this FAQ
concerning the CentOS release scheme:
https://wiki.centos.org/FAQ/General
If you know what you are doing, and absolutely want to remain at the 6.4
level, go to http://vault.centos.org/ for packages.
Please keep in mind that 6.0, 6.1, 6.2, 6.3 and 6.4 no longer gets any updates, nor
any security fix's.
修改163源
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/6/os/x86_64/
将源檔案中的版本修改為系統對應版本,同時修改系統架構。
4. 運作指令生成緩存
[[email protected] yum.repos.d]#yum clean all
[[email protected] yum.repos.d]#yum makecache
參考部落格:https://blog.csdn.net/wang_shen_tao/article/details/78676560