解决更新yum源的[Errno 14] HTTP Error 404 - Not Found

约定不等于承诺〃 2022-03-19 02:38 1750阅读 0赞

在Linux输入一些yum命令时出现如下错误:

  1. Loaded plugins: fastestmirror
  2. http://mirrors.163.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
  3. Trying other mirror.
  4. To address this issue please refer to the below knowledge base article
  5. https://access.redhat.com/articles/1320623
  6. If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
  7. One of the configured repositories failed (CentOS-$releasever - Base - 163.com),
  8. and yum doesn't have enough cached data to continue. At this point the only
  9. safe thing yum can do is fail. There are a few ways to work "fix" this:
  10. 1. Contact the upstream for the repository and get them to fix the problem.
  11. 2. Reconfigure the baseurl/etc. for the repository, to point to a working
  12. upstream. This is most often useful if you are using a newer
  13. distribution release than is supported by the repository (and the
  14. packages for the previous distribution release still work).
  15. 3. Run the command with the repository temporarily disabled
  16. yum --disablerepo=base ...
  17. 4. Disable the repository permanently, so yum won't use it by default. Yum
  18. will then just ignore the repository until you permanently enable it
  19. again or use --enablerepo for temporary usage:
  20. yum-config-manager --disable base
  21. or
  22. subscription-manager repos --disable=base
  23. 5. Configure the failing repository to be skipped, if it is unavailable.
  24. Note that yum will try to contact the repo. when it runs most commands,
  25. so will have to try and fail each time (and thus. yum will be be much
  26. slower). If it is a very temporary problem though, this is often a nice
  27. compromise:
  28. yum-config-manager --save --setopt=base.skip_if_unavailable=true
  29. failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
  30. http://mirrors.163.com/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

是因为yum已经更新了的原因导致的

http://mirrors.163.com/centos/
进官网可以看到已经更新到7.x了

进入7可以看到有repodata/repomd.xml

打开CentOS7-Base.repo(名字可能不一样),一般在 ./etc/yum.repos.d文件夹下

vim /etc/yum.repos.d/CentOS7-Base.repo

将其中baseurl中的$releasever全改为7,如下图:

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMwOTM4NzA1_size_16_color_FFFFFF_t_70

保存

输入命令yum makecache 即可。

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMwOTM4NzA1_size_16_color_FFFFFF_t_70 1

发表评论

表情:
评论列表 (有 0 条评论,1750人围观)

还没有评论,来说两句吧...

相关阅读