cd /etc/yum.repos.d/ mv CentOS-Base.repo CentOS-Base.repo.backup
2.下載163來源###
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo3.把下載檔改成來源檔
mv CentOS6-Base-163.repo CentOS-Base.repo4.執行以下指令產生快取
yum clean all yum makecache
yum makecache可能會出現以下
錯誤:發現仍然是:404 Not Found
Loaded plugins: refresh-packagekit, security http://mirrors.163.com/centos/6Server/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 -"The requested URL returned error: 404 Not Found" Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again我們嘗試進入http://mirrors .163.com/centos...
這時我們進入http://mirrors.163.com/centos/發現:目錄下有6 6.0-6.8目錄,並沒有6Server目錄。猜測$releasever被錯誤地編譯為:6Server;正確情況下應為6.4。 (我的為CentOs6.4)
vi CentOS-Base.repo # 在末行模式下执行以下: :%s/$releasever/6.4 # Esc -> Shift+: 进入末行模式 # 修改完保存退出:Esc -> Shift+: -> wq重新運行
yum makecache哈哈,可能仍然出現與之前相似的錯誤,如下:
Loaded plugins: refresh-packagekit, security http://mirrors.163.com/centos/6.4/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 -"The requested URL returned error: 404 Not Found" Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again再次進入http://mirrors.163.com/centos/發現:目錄下有6.4下只有readme文件,而6目錄下具有完整的文件。所以我們需要再修改一下:把6.4全部修改為6(如果怕一個個修改麻煩,可以重新下載原始檔)如下:
rm -rf CentOS-Base.repo # 先删除6.4的源文件 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo # 把下载文件改成源文件 mv CentOS6-Base-163.repo CentOS-Base.repo yum clean all yum makecacheDone! ! ! ! !