centos 8 yum dnf 源配置
一、centos8自带的源 yum 和 dnf 无法使用,建议切换到centos-vaulti源,方法如下:
sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
二、centos8自带的源 yum 和 dnff 无法使用,也可配置成阿里云的源解决,方法如下:
1、修改 CentOS-AppStream.repo
#vi /etc/yum.repos.d/CentOS-AppStream.repo
[AppStream]
name=CentOS-$releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
2、修改 CentOS-Base.repo
#vi /etc/yum.repos.d/CentOS-Base.repo
[BaseOS]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
3、清理缓存
dnf clean all # 清除所有的缓存文件
dnf makecache # 制作元数据缓存