[root@GXY ~]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# mkdir repo_bak
[root@bogon yum.repos.d]# mv *.repo repo_bak/
到阿里开源镜像站点下载系统对应版本的repo文件.
[root@GXY yum.rehttppos.d]# wget http://mirrors.aliyun.com/repo/Centos-8.repo
$ vi /etc/yum.repos.d/CentOS-cnnic.repo
#清华源如下配置,这里centosplus-cnnic和PowerTools-cnnic中的enabled根据需求打开; [BaseOS-cnnic] name=CentOS-$releasever-Base-cnnic baseurl=https://mirrors.cnnic.cn/centos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official
[AppStream-cnnic] name=CentOS-$releasever-AppStream-cnnic baseurl=https://mirrors.cnnic.cn/centos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official
[extras-cnnic] name=CentOS-$releasever-Extras-cnnic baseurl=https://mirrors.cnnic.cn/centos/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official
[centosplus-cnnic] name=CentOS-$releasever-Plus-cnnic baseurl=https://mirrors.cnnic.cn/centos/$releasever/centosplus/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official
[PowerTools-cnnic] name=CentOS-$releasever-PowerTools-cnnic baseurl=https://mirrors.cnnic.cn/centos/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official
dnf -y install epel-release
dnf clean all
dnf makecache
dnf repolist
[root@bGXY ~]# cd /etc/yum.repos.d/
[root@GXY yum.repos.d]# mkdir repo_bak
[root@GXY yum.repos.d]# mv *.repo repo_bak/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
获得yum软件包
yum -y install epel-release
yum clean all
yum makecache
yum repolist