How to fix yum after CentOS 6 went EOL
yum
upgrades for production use, this is the repository for you.Active subscription is required.
If for whatever reason, you are stuck with the now EOL version of the CentOS operating system, you can no longer run yum upgrade
successfully. Running yum upgrade
in CentOS 6 will yield the following results:
Setting up Upgrade Process
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
Rightfully so, as the YUM repository was removed from the main CentOS update servers, no security or feature upgrades are provided.
However, not all the repositories have halted their support for CentOS 6. The GetPageSpeed repository still provides up-to-date NGINX builds and its module packages.
This may be one reason why you want yum upgrade
to still work. Or simply, you are not ready to move on with a newer operating system, and willing to take the security risks associated with using the older version.
How to fix yum upgrade
then?
Use the CentOS Vault repository
The CentOS Vault repositories have been around for a long time and allow you to stick to a specific CentOS x.y release even while newer ones are available. Now that there will be no newer 6.x, you can simply point your yum
repository configuration to the latest 6.x that will ever be, which is 6.10.
To use the Vault repository, set up its repo configuration instead of the now defunct repositories configuration:
curl https://www.getpagespeed.com/files/centos6-eol.repo --output /etc/yum.repos.d/CentOS-Base.repo
That’s it, everything should be functional.
Alternatively, you can manually replace the contents of the file /etc/yum.repos.d/CentOS-Base.repo
with the necessary configuration.
Copy-paste the entire snippet below and hit Enter:
cat <<-'EOF' > /etc/yum.repos.d/CentOS-Base.repo
[C6.10-base]
name=CentOS-6.10 - Base
baseurl=http://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-updates]
name=CentOS-6.10 - Updates
baseurl=http://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-extras]
name=CentOS-6.10 - Extras
baseurl=http://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-contrib]
name=CentOS-6.10 - Contrib
baseurl=http://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
[C6.10-centosplus]
name=CentOS-6.10 - CentOSPlus
baseurl=http://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
EOF
Now you can run yum upgrade
without problems. This also allows you to get to the latest release 6.10 even if you were left behind at, e.g. 6.7.
Not only yum upgrade
works, but you can also install arbitrary packages as usual.
Fixing EPEL repository
curl https://www.getpagespeed.com/files/centos6-epel-eol.repo --output /etc/yum.repos.d/epel.repo
Fixing SCLO repositories
The repositories containing newer compilation software like gcc
is available via Software Collections.
However, its repositories are likewise gone. Use Vault repositories instead:
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
微信赞赏

支付宝赞赏

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步