1、进入到yum源相应的目录
cd /etc/yum.repos.d/
2、创建备份目录,把相应的文件进行备份
mkdir bak
mv * bak/
3、编辑配置CentOS-Base.repo文件
[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
4、安装epel-release源dnf -y install epel-release
5、清yum缓存,重新加载
dnf clear all
dnf makecache
dnf repolist
来源:51CTO
作者:lqbyz
链接:https://blog.51cto.com/liqingbiao/2476741