DEV Community

Skriptmonkey
Skriptmonkey

Posted on • Originally published at experiencednovice.dev

Migrate CentOS 8 to Alma Linux, Rocky Linux, or CentOS Stream

So you went ahead and upgraded your CentOS 7 (or 6) servers up to CentOS 8 and then Red Hat announced that CentOS was turning into a rolling release distro. This decision has caused a fair amount of controversy on the Internet. A lot of people are upset that their freshly upgraded CentOS 8 servers are going EoL at the end of 2021. In this post I’ll share some options for migrating away from CentOS 8.

Quick note: while writing this guide I’m using a fresh install of CentOS 8. I know that in most situations this will not be the case. Having a properly tested backup of your data is very, VERY important. We can’t assume that everything will go smoothly. Always have a way to restore.

That being said, these will be quick and dirty guides. Before we begin go ahead and SSH into your CentOS server and make sure it’s up-to-date. Reboot if needed.

$ ssh user@centosserver
$ sudo dnf update -y
$ sudo reboot
Enter fullscreen mode Exit fullscreen mode

Migrating to Alma Linux

AlmaLinux is a community governed 1:1 RHEL clone created by CloudLinux to replace the soon-to-be EoL CentOS.

First we’re going to download the almalinux-deploy.sh script.

$ curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
Enter fullscreen mode Exit fullscreen mode

Make the script executable and then run it.

$ chmod +x almalinux-deploy.sh
$ sudo ./almalinux-deploy.sh
Enter fullscreen mode Exit fullscreen mode

Wait until the script finishes running. You should see a “Migration to AlmaLinux is completed” when you’re done.

Reboot the system to apply the changes.

$ sudo reboot
Enter fullscreen mode Exit fullscreen mode

After the reboot you can verify the migration by looking at the /etc/os-release file.

$ cat /etc/os-release
Enter fullscreen mode Exit fullscreen mode

All done! You’ve migrated from CentOS to AlmaLinux.

Migrating to Rocky Linux

Rocky Linux was brought to life by the founder of the CentOS project, Gregory Kurtzer. Rocky intends to be a “100% bug-for-bug” clone of RHEL.

Upgrading to Rocky Linux is as simple as the process for Alma Linux.

First we’re going to download the migrate2rocky.sh script.

$ curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
Enter fullscreen mode Exit fullscreen mode

Make the script executable and execute the script with the -r flag.

$ chmod +x migrate2rocky.sh
$ sudo ./migrate2rocky.sh -r
Enter fullscreen mode Exit fullscreen mode

When the script finishes reboot your system to apply the changes.

You can verify the changes to your system by looking at the /etc/os-release file.

$ cat /etc/os-release
Enter fullscreen mode Exit fullscreen mode

Upgrading to CentOS Stream

The last option that I’m adding into this post, migrating to CentOS Stream.

Also fairly simple, we have three main steps.

First, enable the CentOS Stream repositories.

$ sudo dnf install centos-release-stream
Enter fullscreen mode Exit fullscreen mode

Second, update the CentOS repositories with CentOS Stream repositories.

$ sudo dnf swap centos-{linux,stream}-repos
Enter fullscreen mode Exit fullscreen mode

And finally, migrate CentOS 8 to CentOS Stream.

$ sudo dnf distro-sync
Enter fullscreen mode Exit fullscreen mode

Reboot your system when this command finishes.

You can verify the chances to your system by looking at the /etc/os-release file.

cat /etc/os-release
Enter fullscreen mode Exit fullscreen mode

Top comments (0)