centos6 yum源失效
## 近期centos6 官方已经停止维护, 建议升级到centos7
我们大部分的服务器还是centos6, 因此需要解决,还好官方默认还维护了vault版本.
地址: https://vault.centos.org/6.10/isos/x86_64/
一键解决脚本:
curl -o update-centos6yum.sh https://gitee.com/usmile/jenkinslibrary/raw/master/update-centos6yum.sh
chmod +x update-centos6yum.sh
./update-centos6yum.sh
## 升级方案
$ mkdir /etc/yum.repos.d/backup $ mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/ $ cd /etc/yum.repos.d/ $ vim CentOS-Base.repo [base] name=CentOS-$releasever failovermethod=priority baseurl=https://vault.centos.org/6.10/os/x86_64/ gpgcheck=1 gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-$releasever enabled=1 failovermethod=priority baseurl=https://vault.centos.org/6.10/updates/$basearch/ gpgcheck=1 gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-$releasever enabled=1 failovermethod=priority baseurl=https://vault.centos.org/6.10/extras/$basearch/ gpgcheck=1 gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6 $ vim epel.repo [epel] name=Extra Packages for Enterprise Linux 6 - $basearch baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/$basearch failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 [epel-debuginfo] name=Extra Packages for Enterprise Linux 6 - $basearch - Debug baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/$basearch/debug failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 6 - $basearch - Source baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/SRPMS failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1
## 阿里云的镜像源,上面这个太慢了
[base] name=CentOS-6.10 - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6.10 - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6.10 - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6.10 - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6.10 - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6