登录  /  注册
博主信息
博文 291
粉丝 0
评论 0
访问量 432211
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
解决:Failed to download metadata for repo ‘base‘
原创
1245人浏览过

镜像下载、域名解析、时间同步请点击 阿里云开源镜像站

file

1.先查看本机的系统信息

  1. [root@h0436 h0436 zlong]# cat /etc/redhat-release

2.进入yum.repos.d

  1. [root@h0436 zlong]# cd /etc/yum.repos.d

3.查看镜像文件(看看你需要修改的哪个文件)

  1. [root@h0436 yum.repos.d]# ls
  2. CentOS-Base.repo CentOS-Base.repo.bak epel.repo
  3. CentOS-Base.repo.backup docker-ce.repo

4.修改文件(我的是CentOS-Base.repo.backup文件)

  1. [root@h0436 yum.repos.d]# vim CentOS-Base.repo.backup

5.如果你找不到在哪个文件夹,你就每个文件夹都vim 进去看看,找到CentOS-Base.repo就行

file

6.复制下面这一段配置就行,按键盘上“i”编辑,按ESC退出。如果要保存退出就按:wq,如果不保存退出就按:q (图中标红的地方都是改过之后的地方)

  1. [base]
  2. name=CentOS-8 - Base - mirrors.aliyun.com
  3. failovermethod=priority
  4. baseurl=http://mirrors.aliyun.com/centos/8/os/$basearch/
  5. http://mirrors.aliyuncs.com/centos/8/os/$basearch/
  6. http://mirrors.cloud.aliyuncs.com/centos/8/os/$basearch/
  7. gpgcheck=1
  8. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-8
  9. #released updates
  10. [updates]
  11. name=CentOS-8 - Updates - mirrors.aliyun.com
  12. failovermethod=priority
  13. baseurl=http://mirrors.aliyun.com/centos/8/updates/$basearch/
  14. http://mirrors.aliyuncs.com/centos/8/updates/$basearch/
  15. http://mirrors.cloud.aliyuncs.com/centos/8/updates/$basearch/
  16. gpgcheck=1
  17. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-8
  18. #additional packages that may be useful
  19. [extras]
  20. name=CentOS-8 - Extras - mirrors.aliyun.com
  21. failovermethod=priority
  22. baseurl=http://mirrors.aliyun.com/centos/8/extras/$basearch/
  23. http://mirrors.aliyuncs.com/centos/8/extras/$basearch/
  24. http://mirrors.cloud.aliyuncs.com/centos/8/extras/$basearch/
  25. gpgcheck=1
  26. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-8
  27. #additional packages that extend functionality of existing packages
  28. [centosplus]
  29. name=CentOS-8 - Plus - mirrors.aliyun.com
  30. failovermethod=priority
  31. baseurl=http://mirrors.aliyun.com/centos/8/centosplus/$basearch/
  32. http://mirrors.aliyuncs.com/centos/8/centosplus/$basearch/
  33. http://mirrors.cloud.aliyuncs.com/centos/8/centosplus/$basearch/
  34. gpgcheck=1
  35. enabled=0
  36. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-8
  37. #contrib - packages by Centos Users
  38. [contrib]
  39. name=CentOS-8 - Contrib - mirrors.aliyun.com
  40. failovermethod=priority
  41. baseurl=http://mirrors.aliyun.com/centos/8/contrib/$basearch/
  42. http://mirrors.aliyuncs.com/centos/8/contrib/$basearch/
  43. http://mirrors.cloud.aliyuncs.com/centos/8/contrib/$basearch/
  44. gpgcheck=1
  45. enabled=0
  46. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-8

7.清除缓存

  1. [root@h0436 yum.repos.d]# yum clean all

8.加载缓存

  1. [root@h0436 yum.repos.d]# yum makecache

file

本文转自:https://blog.csdn.net/Along_168163/article/details/124338818

本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学