CentOS 7.9 替换阿里云 Yum 源 一检查yum install -y curlcat /etc/redhat-releaseping -c 4 mirrors.aliyun.com二替换阿里云 Yum 源步骤步骤 1备份原有源配置文件sudo mkdir -p /etc/yum.repos.d/backupsudo mv /etc/yum.repos.d/CentOS-*.repo /etc/yum.repos.d/backup/步骤 2下载阿里云源配置文件# 如果系统未安装 curl/wget可临时使用以下命令若无法下载需检查网络# sudo yum install -y curl wget --disablerepo* --enablerepobase# 下载基础源sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo# 下载 EPEL 扩展源sudo curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo步骤 3清理并重建 Yum 缓存sudo yum clean all # 清理旧缓存sudo yum makecache fast # 生成新缓存三、验证阿里源是否生效方法 1查看仓库列表sudo yum repolist方法 2测试安装软件sudo yum install -y htop建议定期执行 sudo yum update 保持系统更新