• 清理并备份原有仓库配置

    cd /etc/yum.repos.d/
    mkdir backup
    mv *.repo backup/
  • 使用国内镜像源加速

    cat <<EOF > /etc/yum.repos.d/CentOS-Vault.repo
    [base]
    name=CentOS-8 - Base
    baseurl=https://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/x86_64/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-Official
    enabled=1
    
    [appstream]
    name=CentOS-8 - AppStream
    baseurl=https://mirrors.aliyun.com/centos-vault/8.5.2111/AppStream/x86_64/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-Official
    enabled=1
    
    [extras]
    name=CentOS-8 - Extras
    baseurl=https://mirrors.aliyun.com/centos-vault/8.5.2111/extras/x86_64/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-Official
    enabled=1
    EOF
  • 或者使用官方源

    cat <<EOF > /etc/yum.repos.d/CentOS-Vault.repo
    [base]
    name=CentOS-8 - Base
    baseurl=http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    enabled=1
    
    [appstream]
    name=CentOS-8 - AppStream
    baseurl=http://vault.centos.org/8.5.2111/AppStream/x86_64/os/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    enabled=1
    
    [extras]
    name=CentOS-8 - Extras
    baseurl=http://vault.centos.org/8.5.2111/extras/x86_64/os/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    enabled=1
    EOF
  • 清理 YUM 缓存并重新生成

    yum clean all
    yum makecache

标签: CentOS

评论已关闭