yum添加网易和搜狐源

先进入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.repo
sohu的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软件仓库

EPEL全称: Extra Packages for Enterprise Linux.传说中最全的yum源

通过以下命令安装:

CentOS 6.x 32-bit

rpm -Uvh http://mirror.overthewire.com.au/pub/epel/6/i386/epel-release-6-7.noarch.rpm

CentOS 6.x 64-bit

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm

CentOS 5.x 32-bit

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

CentOS 5.x 64-bit

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

想暂停使用EPEL,在下面的文件中设置enabled=0即可.

vim /etc/yum.repos.d/epel.repo


[yasi]:
在执行最后一步,即 yum makecache的时候,遇到错误:
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * addons: mirrors.163.com
 * base: mirror.metrocast.net
 * extras: mirror.beyondhosting.net
 * fasttrack: centos.vipernetworksystems.com
 * updates: centos.vipernetworksystems.com
http://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源地址为:
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 ”,问题解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值