CentOS
How To Fix An End-of-Life (EOL) CentOS 8 System

How To Fix An End-of-Life (EOL) CentOS 8 System

RedHat ended support for CentOS 8 on December 31, 2021 and with it removed the repositories from its primary servers.

Now when you try running a dnf upgrade you will get the following results:

CentOS Linux 8 - AppStream 123 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

This can be fixed by editing the baseurl entries for the CentOS repository files in /etc/yum.repos.d/
These commands should take care of it:

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*

I have chosen vault.centos.org as the alternative, another vault repository location that is arguably more stable is vault.epel.cloud

Migrate to Another Distribution

Ultimately, it is recommended to migrate to another distribution. Here are three of a number of options.

CentOS Stream

CentOS Stream is NOT the same as the classic CentOS in that it is not a true RHEL clone. Instead it tracks just ahead of the current RHEL release as a rolling release linux distribution and not as a stable release distribution. However, this might be sufficient for your use case.
To migrate, follow these steps:

  1. sudo dnf update
    Update the system. If you haven’t done so already you will need to update the repositories following the instructions at the top of this post.
  2. sudo shutdown -r now
    Reboot the system. The prior update probably installed a kernel update that will require a reboot.
  3. cat /etc/centos-release
    CentOS Linux release 8.5.2111
  4. sudo dnf install centos-release-stream
    Install the Centos stream migration package
  5. sudo dnf swap centos-linux-repos centos-stream-repos
    This command will remove the CentOS 8 repos and replace them with the CentOS Stream repos.
  6. sudo dnf distro-sync
    This command will upgrade/downgrade currently installed packages to match the new repositories.
  7. sudo shutdown -r now
    Reboot the system.
  8. cat /etc/centos-release
    CentOS Stream release 8

Rocky Linux 8

Rocky Linux, like the pre-RedHat CentOS, is a free, community-based server-oriented Linux. This RHEL clone tracks RHEL very closely.

  1. dnf update
    Update the system. If you haven’t done so already you will need to update the repositories following the instructions at the top of this post.
  2. shutdown -r now
    Reboot the system. The prior update probably installed a kernel update that will require a reboot.
  3. curl https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh -o migrate2rocky.sh
    Download the migration script.
  4. chmod +x migrate2rocky.sh
    Make the downloaded script executable
  5. ./migrate2rocky.sh
    Run the script
  6. shutdown -r now
    Reboot the system.
  7. cat /etc/redhat-release
    Check the running release is now Rocky Linux 8

Oracle Linux 8

Oracle Linux is close to an exact clone of RHEL and may be a great alternative distribution for your use case.
Just as with Rocky Linux, there is a provided script to carry out the migration.
Follow the steps above replacing steps 3-5 with

3. curl https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh -o centos2ol.sh
4. chmod +x centos2ol.sh
5. ./centos2ol.sh

Leave a Reply

Your email address will not be published. Required fields are marked *