CentOS Linux 8 - AppStream 更换阿里云镜像源安装gcc

来源:网络 点击数: 发布时间:2025年03月03日

问题分析:CentOS Linux 8 - AppStream版本默认mirrorlist.centos.org镜像源地址已无法访问,需要 更换阿里云镜像源安装gcc

处理办法:

  • 备份原有的镜像源配置文件:

sudo mv /etc/yum.repos.d/CentOS-AppStream.repo /etc/yum.repos.d/CentOS-AppStream.repo.backup
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


  • 下载阿里云的镜像源配置文件:

sudo wget -O /etc/yum.repos.d/CentOS-AppStream.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111-AppStream.repo
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  • 清理并生成 YUM 缓存:

sudo dnf clean all
sudo dnf makecache

完成上述操作后,再次尝试下载 GCC 版本:

sudo dnf install gcc