Follow Us

解决Centos8 yum 官方源下线后无法使用问题

1、错误情况

Centos8.2及以上版本,8.1.2009版暂无此问题
更新yum时报错:
1 CentOS-8 - Base - mirrors.aliyun.com 299 B/s | 2.3 kB 00:07
2 Errors during downloading metadata for repository 'base':
3 - Status code: 404 for https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 39.96.118.194)
4 - Curl error (7): Couldn't connect to server for http://mirrors.aliyuncs.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml [Failed to connect to mirrors.aliyuncs.com port 80: Connection timed out]
5 - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
6 Error: Failed to download metadata for repo 'base': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

  • 按照网上教程,更换阿里源、清华源都还是无法使用。

2、原因分析

centos8项目官方已于2021年底停止,相关源已无法使用,所以网上22年前的换源教程都已无法使用。

3、解决方案

进入配置文件内,备份所有的.repo文件(也可以)
#进入配置文件夹
1 mv /etc/yum.repos.d/ /etc/yum.repos.d_bak && mkdir /etc/yum.repos.d/
2 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

  • 如果你没有安装wget,也可以用下面命令:
    1 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  • 运行 dnf makecache 生成缓存
    1 dnf makecache
  • 大功告成!

4、其他

如果你是非阿里云ECS用户,可能回会出现 Couldn’t resolve host ‘mirrors.cloud.aliyuncs.com’ 的信息,不过不影响使用。你可以修改相关的配置:
1 sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

Our Services

Worpress

Lorem ipsum dolor amet consectetur adipiscing elit. Nunc mi dui placerat eu faucibus vel, efficitur quis magna. Pellentesque habitant morbi tristique senectus et netus et malesuada.

Read More

Web Design

Lorem ipsum dolor amet consectetur adipiscing elit. Nunc mi dui placerat eu faucibus vel, efficitur quis magna. Pellentesque habitant morbi tristique senectus et netus et malesuada.

Read More

Ecommerce

Lorem ipsum dolor amet consectetur adipiscing elit. Nunc mi dui placerat eu faucibus vel, efficitur quis magna. Pellentesque habitant morbi tristique senectus et netus et malesuada.

Brand Now

SEO

Lorem ipsum dolor amet consectetur adipiscing elit. Nunc mi dui placerat eu faucibus vel, efficitur quis magna. Pellentesque habitant morbi tristique senectus et netus et malesuada.

Read More

Our Team

zahera

Zahera

(HR)

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean vel tempor sem. Vestibulum suscipit faucibus sem ut porta. Integer ut justo euismod, auctor turpis et

Alex

Alex

(CEO)

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean vel tempor sem. Vestibulum suscipit faucibus sem ut porta. Integer ut justo euismod, auctor turpis et

Alex

Sara

(CCO)

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean vel tempor sem. Vestibulum suscipit faucibus sem ut porta. Integer ut justo euismod, auctor turpis et

Mark

Mark

(Manager)

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean vel tempor sem. Vestibulum suscipit faucibus sem ut porta. Integer ut justo euismod, auctor turpis et

Testimonials

  • Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
    Safira
    (Quia, CEO)
  • At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
    Alana
    (Wirate, PA)
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
    Sara
    (Yahoo, Manager)

Our Partners