How to migrate from CentOS 8 to a supported distro

In case you missed it, CentOS 8 is reaching EOL (End of Life) on December 31, 2021. As of this publishing, that’s only two weeks away! So you’ve already deployed a few CentOS 8 before Red Hat made the announcement. Now what? Are you stuck with this OS with an early death? Good news! You’re not!

Migration, migration, where to go

Thankfully, the community jumped and created options in addition to CentOS’s (recommended, but not preferred) option of migrating to CentOS Stream.

What is the difference between CentOS and CentOS Stream and why would you want to avoid going to Stream? It depends on your use, but CentOS is well regarded as a very stable system designed for servers and critical workstations. Stream is more of a rapid release “test” version.

Traditionally, CentOS was a downstream release of Red Hat Enterprise Linux, meaning CentOS was built from the Red Hat Enterprise Linux source code minus the Red Hat trademarks. Fedora is where everything starts out.

Now, CentOS Stream sits between Fedora and Red Hat Enterprise Linux. While CentOS Stream is certainly “stable”, you can think of it like a beta of RHEL.

For many people, this just isn’t an ideal scenario. Particularly, many web hosting companies use CentOS because it’s essentially Red Hat.

Thankfully, we have options on migrating and different distros to choose from.

AlmaLinux, or Rocky Linux

While you can convert from CentOS 8 to CentOS Stream, chances are you want stability like you had with classic CentOS so we’re just going to take that option off the table. Instead, we’re going to look at AlmaLinux and Rocky Linux. Both are really great distros and I’ve talked about them when they were both in beta.

Picking which one can be a bit challenging. After all, you have options! Let’s take a look at each of the projects.

AlmaLinux

  • Started by Igor Seletskiy of CloudLinux (which is based on RHEL, provides extra security features and patches)
  • CloudLinux has committed $1 million per year of financial backing
  • Setup as a 501(c)6 non-profit and is community-owned
  • Full support from cPanel (so it’s great for web hosting companies)
  • Releases very fast

Rocky Linux

  • Started by Gregory Kurtzer, original co-founder of CentOS
  • Setup as a Public Benefit Corporation (PBC) so full control is still retained by Gregory much like CentOS was
  • Releases are stable

As you can see, both are 1:1 binary compatible with RHEL, it’s just that there’s some differences in the organizational structure.

Migrate to AlmaLinux – Step by step

First thing first, we want to make sure our OS is fully updated.

sudo dnf update

Now we want to reboot to make sure that all changes are applied, especially kernel changes.

sudo reboot

Once your system is back online, we need to get the AlmaLinux deploy script.

curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

Make the script executable.

chmod +x  almalinux-deploy.sh

And then it’s time to start the conversion process.

sudo bash almalinux-deploy.sh

What the script is doing is removing, installing, and even reinstalling some packages and repos to convert the system over to AlmaLinux. This process can take a while depending on the speed of your system. It can take anywhere from 10 minutes to several hours.

When the migration is complete, you’ll get a success message. You can verify you’re now on AlmaLinux by running:

cat /etc/redhat-release

If it says AlmaLinux, you’re set! Now just reboot your system so you boot into the AlmaLinux kernel.

sudo reboot

You’ll now be in AlmaLinux!

Migrate to Rocky Linux – Step by step

First thing first, we want to make sure our OS is fully updated.

sudo dnf update

Now we want to reboot to make sure that all changes are applied, especially kernel changes.

sudo reboot

Once your system is back online, we need to get the migrate2rocky script.

curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh

Make the script executable.

chmod +x migrate2rocky.sh

Start the migration process.

sudo bash migrate2rocky.sh -r

This script will change your repos, remove and reinstall packages for Rocky, and convert your system. This process can take anywhere from 10 minutes to several hours, depending on your hardware.

Once the migration is complete, the script will tell you to reboot your system. Run the following commands:

sudo dnf distro-sync -y
sudo reboot

When you log back in, run the following to verify:

cat /etc/redhat-release

It should say Rocky Linux.

About Travis Newton 19 Articles
I am a Cloud Engineer currently working in the financial and web hosting industry. My passion has been Linux since I first discovered it in 2005. Throughout my career, I have always implemented Linux wherever possible and am an advocate of using open source software over proprietary whenever possible. I strongly believe in the UNIX philosophy of "Do One Thing and Do It Well". I started The Linux Lab as a way for people to discover Linux (and UNIX in general, even macOS users) and to find solutions to problems and learn about Linux.

Be the first to comment

Leave a Reply

Your email address will not be published.


*