ASCII码 ASCII码

解决:Failed to download metadata for repo ‘base‘

发布于:2022-06-15 10:22:04  栏目:技术文档

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

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

相关推荐
阅读 +