博客列表 >Centos8.x yum 源配置 解决 yum 不可用

Centos8.x yum 源配置 解决 yum 不可用

哈
原创
2022年07月29日 15:34:32790浏览

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

备份

  1. [root@iZ2ze1e3u7m7oe426pyndaa ~]# cd /etc/yum.repos.d/
  2. [root@iZ2ze1e3u7m7oe426pyndaa yum.repos.d]# ll
  3. total 48
  4. -rw-r--r-- 1 root root 635 Nov 20 2020 CentOS-AppStream.repo
  5. -rw-r--r-- 1 root root 619 Nov 20 2020 CentOS-Base.repo
  6. -rw-r--r-- 1 root root 701 Nov 20 2020 CentOS-centosplus.repo
  7. -rw-r--r-- 1 root root 1329 Nov 20 2020 CentOS-CR.repo
  8. -rw-r--r-- 1 root root 668 Nov 20 2020 CentOS-Debuginfo.repo
  9. -rw-r--r-- 1 root root 227 Nov 20 2020 CentOS-epel.repo
  10. -rw-r--r-- 1 root root 663 Nov 20 2020 CentOS-Extras.repo
  11. -rw-r--r-- 1 root root 242 Nov 20 2020 CentOS-fasttrack.repo
  12. -rw-r--r-- 1 root root 928 Nov 20 2020 CentOS-Media.repo
  13. -rw-r--r-- 1 root root 639 Nov 20 2020 CentOS-PowerTools.repo
  14. -rw-r--r-- 1 root root 1382 Nov 20 2020 CentOS-Sources.repo
  15. -rw-r--r-- 1 root root 74 Nov 20 2020 CentOS-Vault.repo
  16. [[root@iZ2ze1e3u7m7oe426pyndaa yum.repos.d]# mkdir /home/ydt/yum.repos.d.ori
  17. [root@iZ2ze1e3u7m7oe426pyndaa yum.repos.d]# cp * /home/ydt/yum.repos.d.ori/
  18. [root@iZ2ze1e3u7m7oe426pyndaa yum.repos.d]# ll /home/ydt/yum.repos.d.ori/
  19. total 48
  20. -rw-r--r-- 1 root root 635 Feb 15 14:03 CentOS-AppStream.repo
  21. -rw-r--r-- 1 root root 619 Feb 15 14:03 CentOS-Base.repo
  22. -rw-r--r-- 1 root root 701 Feb 15 14:03 CentOS-centosplus.repo
  23. -rw-r--r-- 1 root root 1329 Feb 15 14:03 CentOS-CR.repo
  24. -rw-r--r-- 1 root root 668 Feb 15 14:03 CentOS-Debuginfo.repo
  25. -rw-r--r-- 1 root root 227 Feb 15 14:03 CentOS-epel.repo
  26. -rw-r--r-- 1 root root 663 Feb 15 14:03 CentOS-Extras.repo
  27. -rw-r--r-- 1 root root 242 Feb 15 14:03 CentOS-fasttrack.repo
  28. -rw-r--r-- 1 root root 928 Feb 15 14:03 CentOS-Media.repo
  29. -rw-r--r-- 1 root root 639 Feb 15 14:03 CentOS-PowerTools.repo
  30. -rw-r--r-- 1 root root 1382 Feb 15 14:03 CentOS-Sources.repo
  31. -rw-r--r-- 1 root root 74 Feb 15 14:03 CentOS-Vault.repo

清空yum源配置文件(注意目录地址)

  1. [root@iZ2ze1e3u7m7oe426pyndaa yum.repos.d]# rm -rf *

下载新的阿里云镜像源

  1. [root@iZ2ze1e3u7m7oe426pyndaa yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  2. --2022-02-15 14:04:11-- https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  3. Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 39.96.118.189, 39.96.118.196, 39.96.118.148, ...
  4. Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|39.96.118.189|:443... connected.
  5. HTTP request sent, awaiting response... 200 OK
  6. Length: 2495 (2.4K) [application/octet-stream]
  7. Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo
  8. /etc/yum.repos.d/CentOS-Base.repo 100%[================================================================================================================>] 2.44K --.-KB/s in 0s
  9. 2022-02-15 14:04:11 (63.2 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo saved [2495/2495]

生成缓存

  1. [root@iZ2ze1e3u7m7oe426pyndaa yum.repos.d]# yum makecache
  2. CentOS-8.5.2111 - Base - mirrors.aliyun.com 25 MB/s | 4.6 MB 00:00
  3. CentOS-8.5.2111 - Extras - mirrors.aliyun.com 296 kB/s | 10 kB 00:00
  4. CentOS-8.5.2111 - AppStream - mirrors.aliyun.com 46 MB/s | 8.4 MB 00:00
  5. Metadata cache created.
  6. [root@iZ2ze1e3u7m7oe426pyndaa yum.repos.d]# ll
  7. total 4
  8. -rw-r--r-- 1 root root 2495 Feb 14 21:16 CentOS-Base.repo

本文转自:https://juejin.cn/post/7116400626094833678

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议