CentOS6.x更改源

CentOS6.x在2020年11月30日的时候官方已经结束支持了, 好在CentOS官方有一个 http://vault.centos.org/ 包含所有发行的CentOS版本。因此新系统只需要将yum源修改为centos-vault的源即可。

更改源

修改配置文件

#改之前先习惯性的备份下配置文件, 执行
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
#然后修改该配置文件, 执行
vi /etc/yum.repos.d/CentOS-Base.repo

* 注释掉mirrorlist ,同时取消注释 baseurl

* 将该文件中所有的http://mirror.centos.org/centos 以及 file:///etc/pki/rpm-gpg 全部替换为http://vault.centos.org

* 将 $releasever 替换为当前系统所使用的CentOS版本

具体可以参考文末的代码部分。

启用&更新源

最后执行 yum clean all && yum makecache  来更新和启用新的yum源。

若提示http://vault.centos.org/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] Peer cert cannot be verified or peer cert invalid尝试其他镜像。

就选用其他源

(下面列的3个是海外源, 国内源请选择: 传送门, 或者自建也可, 反正也不更新了)

http://archive.kernel.org/centos-vault

http://linuxsoft.cern.ch/centos-vault

http://mirror.nsc.liu.se/centos-store

参考如下

*  水这篇文章的时候, 使用http://vault.centos.org官方源直接报错(前天一样的操作还正常来着), 因此这里改用http://mirror.nsc.liu.se/centos-store/ ,当然你也可以选用其他的源, 自行调整即可。

# 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-6.8 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.nsc.liu.se/centos-store/6.8/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.nsc.liu.se/centos-store/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-6.8 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://mirror.nsc.liu.se/centos-store/6.8/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.nsc.liu.se/centos-store/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6.8 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://mirror.nsc.liu.se/centos-store/6.8/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.nsc.liu.se/centos-store/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.8 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://mirror.nsc.liu.se/centos-store/6.8/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.nsc.liu.se/centos-store/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.8 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=http://mirror.nsc.liu.se/centos-store/6.8/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.nsc.liu.se/centos-store/RPM-GPG-KEY-CentOS-6
阅读剩余
THE END