CentOS 8 已在 2021 年底结束支持,CentOS 7 由于用户基数与用户贡献较多,因此会按照计划维护至生命周期结束即 2024 年 6 月 30 日
使用centos-vault
作为停止支持的CentOS的yum源, 国内还有很多centos镜像网站,例如,阿里云,清华源、中科大、上海交大、电子科大源等等。系统版本可以通过执行cat /etc/redhat-release
命令查看, 我的系统是CentOS 8.3.2011
决定选用清华源镜像, 官方说明文档: https://mirrors.tuna.tsinghua.edu.cn/help/centos-vault
cp -r /etc/yum.repos.d ./
CentOS-Base.repo
, 可以将8.3.2011
替换成自己的版本号cat > /etc/yum.repos.d/CentOS-Base.repo << "EOF"
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/8.3.2011/BaseOS/$basearch/os/
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/8.3.2011/extras/$basearch/os
gpgcheck=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-Official
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/8.3.2011/centosplus/$basearch/os
gpgcheck=1
enabled=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-Official
#additional packages that extend functionality of existing packages
[AppStream]
name=CentOS-$releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/8.3.2011/AppStream/$basearch/os
gpgcheck=1
enabled=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-Official
EOF
yum makecache -y
更新软件包缓存, 如果有报错的话可以删掉/etc/yum.repos.d/
下面的其他repo文件只保留/etc/yum.repos.d/CentOS-Base.repo
这一个repo文件