fbpx

Server Setup

How to fix yum after CentOS 6 went EOL

by , , revisited on


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth 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.epel.cloud/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.epel.cloud/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.epel.cloud/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.epel.cloud/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.epel.cloud/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

Want to say thanks?

  1. iwakgatul

    you save my life

  2. balc3r

    Thank You !

  3. Ankit kumar

    Thanku !! sir !!
    It is working for me. !!

  4. Eagle

    I executed “curl https://www.getpagespeed.com/files/centos6-eol.repo –output /etc/yum.repos.d/CentOS-Base.repo”
    and I got this error: “curl (35) SSL connect error” Could you please help?

    • Danila Vershinin

      It means your distro is too old to support recent SSL version. Use the manual configuration as mentioned instead of curl command.

      • Eagle

        Please bear with me. I am very new to this. When I tried to paste the entire snippet, it seemed only the very first line got executed. How to make it execute the entire thing? I am using Putty. Thanks Danila.

        • Danila Vershinin

          Why did you think only the first line was executed? What was the output?

          • Eagle

            I would like to send you a screenshot. But it looks like this:
            [root@sjmrt4 ~]# cat <<-‘EOF’ > /etc/yum.repos.d/CentOS-Base.repo

            [6.10-base] (from now on, every line is started with “>” symbol)
            ……..
            EOF (this is the last line before I hit Enter)
            After I hit Enter, it’s back to:
            [root@sjmrt4 ~]#

        • Danila Vershinin

          Instead of copy-pasting as command you can simply edit /etc/yum.repos.d/CentOS-Base.repo and paste in contents starting from [C6.10-base] to metadata_expire=never inclusive. That is essentially what the command way does anyway – overwrites the file with the different content.

          • Eagle

            Thank you so much Danila. I will do that. Happy New Year!

  5. Beau Sanders

    Fantastic. Your repos are awesome. Thank you for doing this. Now we can upgrade to CentOS7.

  6. tech

    hello,

    how do you upgrade to Centos 7 from 6 or RHEL 7 from RHEL 6 ?
    Please share.

    • Danila Vershinin

      The answer is that technically you don’t upgrade. CentOS 6 and CentOS 7 are quite different to begin with, example for their usage of different init systems. The best way to go around upgrading is setting up a separate server with CentOS 7 and install/configure the software needed there. The task can be made reproducible with configuration management tools like ansible.

  7. tech

    hi,
    I been searching for a workaround solution, but it not working.
    Some users want to keep their files and applications on the CentOS 6 by not do a fresh installation.
    I’ve tried this method, but it didn’t work: redacted

    • Danila Vershinin

      You must do a clean install of CentOS 7 to get it. By spending all that time trying to find a way to upgrade in-place, you could already have “yum install”ed the things you have in CentOS 6.
      Don’t waste your time.
      Server setup can be done quickly in most cases. Only in rare situations, you need to migrate an app that otherwise won’t work readily in CentOS 7.

  8. CrazyOptimist

    Awesome!

  9. MraWorker

    Super solution. Thank you very much. We do’nt work alone with you.

  10. TB (@thetandb)

    Thanks. Really.

  11. idrus

    TQ BRO…you save my day….

  12. hck28

    Thanks Danila. Awasome.

  13. Gabe Verrault

    I edited the CentOS-Base.repo file as indicated in the directions, copying from [C6.10-base] though metadata_expire=never but I’m getting the following error when I run yum update

    [Errno 14] Peer cert cannot be verified or peer cert invalid

    Error: cannot retrieve repository metadata (repomd.xml) for repository C6.10-base. Please verify its path and try again.

    Any help would be appreciated. Thanks.

    • Danila Vershinin

      You can temporarily add sslverify=false to /etc/yum.conf.

  14. Emiliano

    Everything went well, thanks, guys.

  15. Amy

    Thank you so much! This worked!

  16. Clifford

    Thank you very much for sharing! This is useful for my sandbox with centos 6 built.

  17. sivaraam73Sivaraam

    Excellent Solution, worked immediately like a charm, good work Danila and thanks a million !!

  18. Gabe Verrault

    I did try adding sslverify=false option into the /etc/yum.conf file but I’m not seeing any change in regards to the error that is appearing

  19. VizardKnight

    Life saver… dude
    you rock!

Comments are closed.