一、進入到yum源相應的目錄
cd /etc/yum.repos.d/
二、建立備份目錄,把相應的文件進行備份
mkdir bak
mv * bak/
三、編輯配置CentOS-Base.repo文件centos
[root@localhost yum.repos.d]# cat CentOS-Base.repo # file: /etc/yum.repos.d/CentOS-AppStream.repo [aliyun-AppStream] name=CentOS-$releasever - AppStream baseurl=http://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial # file: /etc/yum.repos.d/CentOS-Base.repo [aliyun-BaseOS] name=CentOS-$releasever - Base baseurl=http://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [aliyun-extras] name=CentOS-$releasever - Extras baseurl=https://mirrors.aliyun.com/centos/8.0.1905/extras/x86_64/os/ enabled=1 gpgcheck=1
四、安裝epel-release源dnf -y install epel-release
五、清yum緩存,從新加載緩存
dnf clear all dnf makecache dnf repolist