备份官方源
cd /etc/yum.repos.d
mkdir backup
mv ./CentOS-* ./backup/
使用腾讯源
在目录/etc/yum.repos.d下,创建 CentOS-Base.repo 文件
vi /etc/yum.repos.d/CentOS-Base.repo
写入如下内容
[base]
name=CentOS-$releasever - Base - mirrors.cloud.tencent.com
#failovermethod=priority
baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.cloud.tencent.com
#failovermethod=priority
baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.cloud.tencent.com
#failovermethod=priority
baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
[PowerTools]
name=CentOS-$releasever - PowerTools - mirrors.cloud.tencent.com
#failovermethod=priority
baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
[AppStream]
name=CentOS-$releasever - AppStream - mirrors.cloud.tencent.com
#failovermethod=priority
baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
创建缓存
yum makecache
文章作者:DOTATONG
发布日期:2022-04-02
评论