CentOS 7.8更换yum源

由于默认yum源地址是国外,下载不方便,将其更新为国内的

备份原有配置

cd /etc/yum.repos.d && cp CentOS-Base.repo CentOS-Base.repo_backup

如何存在epel配置,删除

rm -rf epel*

修改CentOS-Base.repo

如果内核版本不是7.8,查看当前内核信息,将7.8.2003替换,查看内核命令cat /etc/redhat-release

开始配置
$ vi CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.8.2003/os/x86_64/
gpgcheck=1
gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/RPM-GPG-KEY-CentOS-$releasever

[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.8.2003/updates/x86_64/
gpgcheck=1
gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/RPM-GPG-KEY-CentOS-$releasever

[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.8.2003/extras/x86_64/
gpgcheck=1
gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/RPM-GPG-KEY-CentOS-$releasever

[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.8.2003/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/RPM-GPG-KEY-CentOS-$releasever

[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.8.2003/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/RPM-GPG-KEY-CentOS-$releasever

更新配置

清除信息yum clean all,建立元数据缓存yum makecache