Linux (CentOS 7) 更换国内镜像源

2025-04-28 361 0

当你遇到错误提示

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"

如果已经排除了网络问题,那么通常是因为无法访问镜像源服务器。这种情况下,可以通过手动指定一个 CentOS 7 的镜像源来解决问题。例如:

// 下载aliyun镜像源配置文件
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

// 清除缓存
yum clean all

// 创建缓存
yum makecache

相关文章

Linux (CentOS 7) 内网环境下离线升级 OpenSSL 到 3.5
Linux (CentOS 7) 升级 OpenSSL 到 3.5
Linux (CentOS 7) 安装 Mysql 8.4.5
Linux (CentOS 7) 源码编译安装 Nginx 1.26.3
Linux (CentOS 7) 安装 Redis 7.4.3

发布评论