Skip to main content

CentOS 6 停止支持后yum不能使用

在服务器上安装 git 的时候一直报 404,我以为是源出问题了,换了其他源还是错误,后来想到了 CentOS 6 停止支持了。在网上找了很久,终于找到了官方 vault 源:https://vault.centos.org 支持旧版本系统。

切换方式

  1. 编辑 /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-6.9 - Base
failovermethod=priority
baseurl=http://vault.centos.org/6.9/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6.9 - Updates
failovermethod=priority
baseurl=http://vault.centos.org/6.9/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6.9 - Extras
failovermethod=priority
baseurl=http://vault.centos.org/6.9/extras/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.9 - Plus
failovermethod=priority
baseurl=http://vault.centos.org/6.9/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.9 - Contrib
failovermethod=priority
baseurl=http://vault.centos.org/6.9/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
  1. 删除/etc/yum.repos.d下的其他 repo 文件
  2. 执行yum clean all && yum make cache

其他

vault 源很慢很慢,将就用吧