当前位置:网站首页 > R语言数据分析 > 正文

fedora更换国内源(centos8更换国内源)



新安装的centos8访问yum源时,常见错误如下:

[root@localhost ~]# yum list
CentOS Linux 8 – AppStream 0.0 B/s | 0 B 00:00
Errors during downloading metadata for repository ‘appstream’:
– Curl error (6): Couldn’t resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]
错误:为仓库 ‘appstream’ 下载元数据失败 : Cannot prepare internal mirrorlist: Curl error (6): Couldn’t resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]










可以替换为国内的软件源,比如阿里云的:

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ll
总用量 52
-rw-r–r–. 1 root root 568 11月 2 05:30 CentOS-Base.repo
-rw-r–r–. 1 root root 719 9月 14 2021 CentOS-Linux-AppStream.repo
-rw-r–r–. 1 root root 704 9月 14 2021 CentOS-Linux-BaseOS.repo
-rw-r–r–. 1 root root 1130 9月 14 2021 CentOS-Linux-ContinuousRelease.repo
-rw-r–r–. 1 root root 318 9月 14 2021 CentOS-Linux-Debuginfo.repo
-rw-r–r–. 1 root root 732 9月 14 2021 CentOS-Linux-Devel.repo
-rw-r–r–. 1 root root 704 9月 14 2021 CentOS-Linux-Extras.repo
-rw-r–r–. 1 root root 719 9月 14 2021 CentOS-Linux-FastTrack.repo
-rw-r–r–. 1 root root 740 9月 14 2021 CentOS-Linux-HighAvailability.repo
-rw-r–r–. 1 root root 693 9月 14 2021 CentOS-Linux-Media.repo
-rw-r–r–. 1 root root 706 9月 14 2021 CentOS-Linux-Plus.repo
-rw-r–r–. 1 root root 724 9月 14 2021 CentOS-Linux-PowerTools.repo
-rw-r–r–. 1 root root 1124 9月 14 2021 CentOS-Linux-Sources.repo











































先备份原来的软件源到指定目录下:

[root@localhost yum.repos.d]# mkdir yum.bak
[root@localhost yum.repos.d]# ll
总用量 52
-rw-r–r–. 1 root root 568 11月 2 05:30 CentOS-Base.repo
-rw-r–r–. 1 root root 719 9月 14 2021 CentOS-Linux-AppStream.repo
-rw-r–r–. 1 root root 704 9月 14 2021 CentOS-Linux-BaseOS.repo
-rw-r–r–. 1 root root 1130 9月 14 2021 CentOS-Linux-ContinuousRelease.repo
-rw-r–r–. 1 root root 318 9月 14 2021 CentOS-Linux-Debuginfo.repo
-rw-r–r–. 1 root root 732 9月 14 2021 CentOS-Linux-Devel.repo
-rw-r–r–. 1 root root 704 9月 14 2021 CentOS-Linux-Extras.repo
-rw-r–r–. 1 root root 719 9月 14 2021 CentOS-Linux-FastTrack.repo
-rw-r–r–. 1 root root 740 9月 14 2021 CentOS-Linux-HighAvailability.repo
-rw-r–r–. 1 root root 693 9月 14 2021 CentOS-Linux-Media.repo
-rw-r–r–. 1 root root 706 9月 14 2021 CentOS-Linux-Plus.repo
-rw-r–r–. 1 root root 724 9月 14 2021 CentOS-Linux-PowerTools.repo
-rw-r–r–. 1 root root 1124 9月 14 2021 CentOS-Linux-Sources.repo
drwxr-xr-x. 2 root root 6 11月 2 05:35 yum.bak
[root@localhost yum.repos.d]# mv *.repo yum.bak/
[root@localhost yum.repos.d]# ll
总用量 4
drwxr-xr-x. 2 root root 4096 11月 2 05:36 yum.bak
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
–2024-11-02 05:37:00– https://mirrors.aliyun.com/repo/Centos-8.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)… 116.196.135.211, 116.196.135.214, 116.196.135.212, …
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|116.196.135.211|:443… 已连接。
已发出 HTTP 请求,正在等待回应… 200 OK
长度:2590 (2.5K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”















































































/etc/yum.repos.d/CentOS-Base. 100%[=================================================>] 2.53K –.-KB/s 用时 0s

2024-11-02 05:37:00 (48.4 MB/s) – 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2590/2590])

删除缓存

[root@localhost yum.repos.d]# yum clean all
0 文件已删除

重建缓存
[root@localhost yum.repos.d]# yum -y makecache
CentOS-8 – Base – mirrors.aliyun.com 8.2 MB/s | 4.6 MB 00:00
CentOS-8 – Extras – mirrors.aliyun.com 6.8 kB/s | 10 kB 00:01
CentOS-8 – AppStream – mirrors.aliyun.com 9.2 MB/s | 8.4 MB 00:00
元数据缓存已建立。
[root@localhost yum.repos.d]# yum repolist
仓库 id 仓库名称
AppStream CentOS-8 – AppStream – mirrors.aliyun.com
base CentOS-8 – Base – mirrors.aliyun.com
extras CentOS-8 – Extras – mirrors.aliyun.com




























安装宝塔面板测试一下:

install.sh 100%[=================================================>] 48.20K –.-KB/s 用时 0.09s

2024-11-02 05:39:31 (522 KB/s) – 已保存 “install.sh” [49358/49358])

声明: 除非转自他站(如有侵权,请联系处理)外,本文采用 BY-NC-SA 协议进行授权 | 嗅谱网
转载请注明:转自《解决CentOS 8 yum软件源下载失败的问题
本文地址:http://www.xiupu.net/archives-11377.html
关注公众号:智乐兔







赞赏

到此这篇fedora更换国内源(centos8更换国内源)的文章就介绍到这了,更多相关内容请继续浏览下面的相关 推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • red hat linux挂载u盘(redhat挂载u盘命令)2026-05-17 08:18:10
  • third的缩写(thirtieth的缩写)2026-05-17 08:18:10
  • scapy读取pcap(scapy读取pcap包转为str)2026-05-17 08:18:10
  • ifstream读取文件只能读取一半(ifstream fin读取)2026-05-17 08:18:10
  • resnet模型代码(resnet网络模型)2026-05-17 08:18:10
  • nrm安装成功但是不是内外命令(nrm不是内部或外部命令)2026-05-17 08:18:10
  • rang me up什么意思(you raise me up是什么)2026-05-17 08:18:10
  • seaotter英语怎么读(seatbelt英语怎么读)2026-05-17 08:18:10
  • cra什么意思中文(crazing是什么意思)2026-05-17 08:18:10
  • Tornadoes听力原文(to define graffiti 听力答案)2026-05-17 08:18:10
  • 全屏图片