CentOS 6 停產(chǎn)后如何修復(fù)yum?
概述

CentOS 開發(fā)者郵件列表顯示,CentOS 6 已于11月30日 EOL,如果由于某種原因,您被困在 CentOS 操作系統(tǒng)的現(xiàn)在EOL(生命的盡頭)版本,您將無法再yum upgrade成功運(yùn)行。yum upgrade在 CentOS 6 中運(yùn)行將產(chǎn)生以下結(jié)果:
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

更換yum源
CentOS官方:http://vault.centos.org/
阿里云鏡像:
http://mirrors.aliyun.com/centos-vault/

1、關(guān)閉fastestmirror
- [root@localhost ~]# vi /etc/yum/pluginconf.d/fastestmirror.conf
- [main]
- enabled=0 #修改為0
- verbose=0
2、替換為官方Vault源
- mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
- #替換為官方Vault源
- wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Official.repo
3、替換為阿里云Vault鏡像
- wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Aliyun.repo
修復(fù) EPEL 存儲(chǔ)庫
- curl https://www.getpagespeed.com/files/centos6-epel-eol.repo --output /etc/yum.repos.d/epel.repo
修復(fù) SCLO 存儲(chǔ)庫
包含較新編譯軟件的存儲(chǔ)庫gcc可通過 Software Collections 獲得。
但是,它的存儲(chǔ)庫同樣消失了。改用 Vault 存儲(chǔ)庫:
- yum -y install centos-release-scl
- curl https://www.getpagespeed.com/files/centos6-scl-eol.repo --output /etc/yum.repos.d/CentOS-SCLo-scl.repo
- curl https://www.getpagespeed.com/files/centos6-scl-rh-eol.repo --output /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo