cd /etc/yum.repos.d/ mv CentOS-Base.repo CentOS-Base.repo.backup
登入後複製
2.下載163來源###
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
登入後複製
mv CentOS6-Base-163.repo CentOS-Base.repo
登入後複製
yum clean all yum makecache
登入後複製
yum makecache可能會出現以下
錯誤:發現仍然是:404 Not Found
我們嘗試進入http://mirrors .163.com/centos...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/發現:目錄下有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
登入後複製
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 makecache
登入後複製