# 查看系统信息 cat /etc/redhat-release
# centos8更换国内源(阿里源) # 1. 备份配置文件 sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup # 2.下载新的CentOS-Base.repo到 /etc/yum.repos.d/ sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo # 3.替换部分字段(阿里云不需要) sudo sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo # 生成缓存 yum makecache