Centos换163的yum源--Tencent云主机

本文分享了在Tencent云主机上使用Centos6.6过程中遇到的yum源配置问题及解决方案,包括修改repo文件中releasever参数和baseurl地址等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

换了不知道多少次yum源。最后yum直接不能用了。还好找到补救措施。
就是希望后来的People不要像我一样走那么多弯路了。
我的主机时Tencent云主机,系统:Centos6.6
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old
cd /etc/yum.repos.d/
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报错:http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - “The requested URL returned error: 404 Not Found”

/下面这段话是百度上经常搜索到的。可是对我一点用没有,不过我还是粘贴下来给大家参考/
这是因为无法访问http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml,repomd.xml 在http://mirrors.163.com/centos/6-6.5下已经不存在,需要更改CentOS-Base.repo此文件中的 releasever releasever来源于 rpm -qi centos-release 的version数值 。
centos6.X一般取值为6,因此报错。
更正操作为
vi CentOS-Base.repo
替换掉releasever : s/ releasever/6.6/g
替换掉后已经可以yum makecache 了

/我想说的是,网上很多方法我都试过了,都不行,下面我说一下我的解决办法/

cd /etc/

ls

找到yum.repos.d这个目录,里面有个文件zl.repo(你的机器里也许不是这个名字,名称应该是自定义的),vi 编译一下里面的地址baseurl=http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml
/这样就完成了,上面是改了后的地址,原本里面是http://tencent.com/centos—-记不住了,反正是腾讯的云源/

[root@localhost yum.repos.d]# grep -ril "mirrors.163.com" /etc/yum.repos.d/ | xargs sed -i '/addons/,/mirrors.163.com/s/enabled=1/enabled=0/' # 禁用所有163 addons[^1] [root@localhost yum.repos.d]# [root@localhost yum.repos.d]# # 或直接删除特定配置 [root@localhost yum.repos.d]# rm -f /etc/yum.repos.d/CentOS-Addons.repo # 常见 问题文件 [root@localhost yum.repos.d]# # 下载阿里云CentOS 7基础 [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo --2025-06-02 00:28:45-- https://mirrors.aliyun.com/repo/Centos-7.repo 正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 111.47.234.74, 111.47.122.101, 111.47.234.79, ... 正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|111.47.234.74|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:2523 (2.5K) [application/octet-stream] 正在保存至: “/etc/yum.repos.d/CentOS-Base.repo” 100%[======================================>] 2,523 --.-K/s 用时 0s 2025-06-02 00:28:45 (663 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523]) [root@localhost yum.repos.d]# [root@localhost yum.repos.d]# # 注释addons段(阿里云配置中可能已无addons) [root@localhost yum.repos.d]# sed -i '/\[addons\]/,/^\[/ s/^enabled=1/enabled=0/' /etc/yum.repos.d/CentOS-Base.repo [root@localhost yum.repos.d]# yum clean all # 清除所有缓存 已加载插件:fastestmirror, langpacks 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 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 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 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 正在清理软件: addons base extras updates Cleaning up list of fastest mirrors [root@localhost yum.repos.d]# yum makecache # 重建元数据 已加载插件:fastestmirror, langpacks 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 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 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 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 Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com http://mirrors.163.com/centos/7/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found 正在尝试其它镜像。 To address this issue please refer to the below wiki article https://wiki.centos.org/yum-errors If above article doesn't help to resolve this issue please use https://bugs.centos.org/. One of the configured repositories failed (CentOS-7 - Addons - 163.com), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=addons ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable addons or subscription-manager repos --disable=addons 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=addons.skip_if_unavailable=true failure: repodata/repomd.xml from addons: [Errno 256] No more mirrors to try. http://mirrors.163.com/centos/7/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
最新发布
06-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值