由于centos8自带的源速度实在太慢,不得不替换成国内源。

下面是配置阿里源的命令。

1、安装wget,已安装跳过

dnf -y install wget

2、更改默认源为阿里源

wget -O /etc/yum.repos.d/CentOS-aliyun-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
mv /etc/yum.repos.d/CentOS-aliyun-Base.repo /etc/yum.repos.d/CentOS-Base.repo
dnf clean all
dnf makecache
dnf -y update

3、安装epel

dnf -y install epel-release

4、epel更换阿里源

cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
cp /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
yum clean all
yum makecache
yum -y update