Want to migrate from CentOS 8 to Rocky Linux 8 the hassle-free way? This tutorial will show you the full process of how it’s done along with the necessary commands.
After the announcement from Red Hat that CentOS will be discontinued, CentOS founder Gregory Kurtzer started the Rocky Linux project.
Although relatively new in the Linux world, Rocky Linux is well known for its stability, reliability, performance, and high-performance computing. It’s an ideal option as a server. If you’re currently running CentOS 8 and trying to move to Rocky Linux 8, then this is the right place to learn how you can do it safely and most easily.
Let’s get started!
Prerequisites For Migrating from CentOS to Rocky Linux
Before you start the migration process, it’s important to know what tools you need and other prerequisites for successfully switching from CentOS 8 to Rocky Linux 8.
- CentOS 8 or CentOS 8 Stream server
- Root access (Or use sudo at the beginning of your commands)
- Terminal for issuing commands
- Backup of CentOS (Optional)
- Git (If you choose to go the Git route)
How to Migrate from CentOS to Rocky Linux
After all the preparations are done, let’s move on to the step-by-step process. The process itself is super easy. However, a little mistake can cost a lot, so be careful when issuing commands. We suggest you double-check every command before running them.
Here are the steps for the migration:
Backup CentOS 8
Although it’s an easy and fast process, just to be on the safe side, you should take a backup of your current CentOS server. This allows you to come back to a previous state if you unintentionally do something wrong.
You should have the last snapshot before you start the migration process.
Update CentOS 8
Before migrating, you may want to update your operating system to the latest version. To check your version you can use this command:
$ cat /etc/centos-release
Alternatively, you can use the more or less command.
$ more /etc/centos-release
$ less /etc/centos-release
Either command produces the same result—the CentOS version you’re currently running.
To update your OS version, run this command:
$ sudo dnf update
Make sure to reboot your machine before proceeding to the next step. Use this command:
$ sudo reboot now
Once the update is completed and the reboot is done, check again for the release version.
Download the Rocky Linux Migration Script
There are multiple ways you can fetch the Rocky Linux migration script to your device. We’ll show them all.
Download Using GUI
If you just want to download it from GitHub through your browser, then
- Head to this Github repo.
- Go to Code > Download ZIP.
- Save the ZIP file to a suitable location.
- Unzip the file.
Then use the following command:
$ scp PATH/migrate2rocky.sh [email protected]:/home/
Change the path and user information to match yours.
Download Using Git
If you already have git installed, then clone the Rocky Tools repository with it. If you don’t have it installed, use this command to install it:
$ sudo dnf install git
After installing git, clone the repo with this command:
$ sudo git clone https://github.com/rocky-linux/rocky-tools.git
Download Using Command-Line Utilities
You can also use utilities such as
lynx to get the script directly from the web. We’re going to use curl to show you how it’s done. Feel free to try the other options.
Get the script using this command:
$ curl https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh -o migrate2rocky.sh
Execute the Rocky Linux Migration Script
Now that you’ve downloaded the script, it’s time to execute it. First, navigate to the directory where you downloaded it. For this tutorial, we downloaded the script in a folder called “Rocky Linux”. So we will navigate there using the following command:
$ cd “Rocky Linux”/
Next, you need to change the file permission to execute it. Do so by running this command:
$ chmod u+x migrate2rocky.sh
The last thing to do is run the script. Run it by issuing this below command:
$ ./migrate2rocky.sh -r
You should see a screen like the above screenshot. It will take some time since there are a lot of things to be converted. So be patient.
Once you see the “Complete” message, this means the migration should be successful. If you want to check the installation log, you can open the log file with this command:
$ cat var/log/migrate2rocky.log
Alright, now reboot your system once more and see if everything went according to plan. Run this command:
$ sudo systemctl reboot now
Verifying if Migrating from CentOS to Rocky Linux Was Successful
You can do this easily by checking the OS version just like we saw earlier in the tutorial. Use either of the following commands:
$ cat /etc/rockylinux-release
$ cat /etc/centos-release
This short guide shows you how to migrate from CentOS 8 to Rocky Linux 8. We’ve explained the whole process in a few steps and shown the required commands.
We’ve discussed different methods of performing the migration so that you can choose the most suitable one for you. If you face any difficulty, let us know in the comments below.
If this guide helped you, please share it.