先进入yum源配置目录
cd /etc/yum.repos.d
备份系统自带的yum源
mv CentOS-Base.repo CentOS-Base.repo.save
163的yum源:
wget http://mirrors.163.com/.help/CentOS-Base-163.reposohu的yum源:
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
或者:cd /etc/yum.repos.d/; wget http://mirrors.163.com/.help/CentOS-Base-163.repo -O 163.repo; sed -i -e "s/\$releasever/6.6/g" -e "s/gpgcheck=1/gpgcheck=0/g" -e "28,35d" 163.repo; yum makecache
(记得替换$releasever为6.6或者5.10)
更新玩yum源后,建议更新一下,使操作立即生效
yum makecache
为CentOS安装EPEL软件仓库
[yasi]:
在执行最后一步,即
yum makecache的时候,遇到错误:
Loaded plugins: fastestmirrorRepository base is listed more than once in the configurationRepository updates is listed more than once in the configurationRepository extras is listed more than once in the configurationRepository centosplus is listed more than once in the configurationRepository contrib is listed more than once in the configurationLoading mirror speeds from cached hostfile* addons: mirrors.163.com* base: mirror.metrocast.net* extras: mirror.beyondhosting.net* fasttrack: centos.vipernetworksystems.com* updates: centos.vipernetworksystems.comhttp://mirrors.163.com/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"Trying other mirror.http://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"Trying other mirror.Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again
从上可看出,提示的是 404错误,即找不到相关文件,估计地址 “
http://mirrors.163.com/.help/CentOS-Base-163.repo
” 太老,而我用的是最新的
CentOS 6.6
,登录到163 yum源的官网(
http://mirrors.163.com/.help/centos.html
),发现如下信息:
CentOS 5.X系列的 yum源地址为:
而CentOS 6.X系列的yum源地址为:
注意 红色 数字,是有区别的,也就是说,我下载的 “ CentOS-Base-163.repo ” 是错误的,尽管能被下载下来。
重新下载新版本的“ CentOS6-Base-163.repo ”,问题解决。
CentOS 5.X系列的 yum源地址为:
http://mirrors.163.com/.help/CentOS 5-Base-163.repo
而CentOS 6.X系列的yum源地址为:
http://mirrors.163.com/.help/CentOS 6-Base-163.repo
注意 红色 数字,是有区别的,也就是说,我下载的 “ CentOS-Base-163.repo ” 是错误的,尽管能被下载下来。
重新下载新版本的“ CentOS6-Base-163.repo ”,问题解决。