CIQ

How to Migrate CentOS to Rocky Linux

How to Migrate CentOS to Rocky Linux
October 25, 2022

Prerequisites

Before we get into the migration process, let’s make sure you’re set up for success.

  1. Back it up -  Back up all critical data before you move on to the next step 

  2. Server - Your current Linux version (CentOS Stream, CentOS, Alma Linux, RHEL, or Oracle Linux) should currently be running on a VPS or bare metal server.

  3. Version - The current supported upgrade matrix for the various Linux distros and the exact tools needed are:

Source Linux Distribution/VersionTarget Rocky Linux VersionTool/Script
CentOS Stream, CentOS, Alma Linux, RHEL, or Oracle Linux Version 8.xRocky Linux 8.xmigrate2rocky.sh
CentOS Stream, CentOS, Alma Linux, RHEL, or Oracle Linux Version 9.xRocky Linux 9.xmigrate2rocky9.sh
  1. Read the documentation - Make sure you’ve read this guide and as well as the documentation on rockylinux.org before getting started. If you’re migrating from CentOS to Rocky Linux, be sure to watch our webinar.

  2. Your experience - We assume you’re not a beginner and that you have:

  • A working knowledge of the command line

  • A working knowledge of SSH for remote machines

  • The ability to run commands as roo

  1. Know when to contact CIQ - Contact CIQ immediately if:
  • The script fails

  • Migration needs to be done in air-gapped environments

  • Any of the requirements in (6) above are unmet

  • Migration needs to be performed on mission-critical systems

  • Call us at any point if you are uncomfortable running the script

The Rocky Linux project is hosted by the Rocky Enterprise Software Foundation (RESF). Its mission is to advance Rocky Linux to meet the needs of the open source community that supports it and ensure Rocky Linux’ long-term independence.
  1. Warning! Do not migrate to Rocky LInux in a production environment until you’ve tested it on an identical installation in a lab or non-production  environment to ensure success. Also, if you have custom-installed software or custom-compiled modules, proceed with caution. There could be failures during the conversion that could leave your machine inoperable.

Download the script

There are three ways to download Rocky Linux:

Option 1: Download the compressed archive from GitHub and extract the correct script (migrate2rocky.sh or migrate2rocky9.sh) for your scenario. You’ll find the zip files for any GitHub repo on the right side of the repo’s main page.

how to migrate centos to rocky linux github 1024x629

Once you’ve downloaded the compressed archive, it’s time to upload the executable to your server with ssh by running this command on your local machine. Obviously, you’ll need to change the file paths/server domains/IP addresses to match your environment:

scp /PATH/TO/FILE/migrate2rocky.sh USER@SERVER:/home/USER

Or

scp /PATH/TO/FILE/migrate2rocky9.sh USER@SERVER.com:/home/USER

Where USER is your remote username and SERVER is either the IP address or domain of the remote server.

Option 2: Download the Rocky Linux migration script via git. Make sure the git command is installed. And then use git to clone the rocky-tools repository by typing the following:

git clone https://github.com/rocky-linux/rocky-tools.git

Please note that cloning the rocky-tools repository will also automatically pull down all of the scripts and files in the repository.

Option 3: Download the Rocky Linux migration script. 

To download the script for the CentOS|Alma|RHEL 8.x to Rocky Linux 8.x migration scenarios straight into your current working directory (CWD), run the following command:

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

Alternatively, to download the script for the CentOS|Alma|RHEL 9.x to Rocky Linux 9.x migration scenarios straight into your CWD, run the following command:

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

Keep in mind that either of these commands will download only the file that you want.

Set the script file permissions

To execute the script, switch to the directory where the script is located by using the cd command. Use the chmod command to ensure that the file is executable.

For the CentOS|Alma|RHEL 8.x to Rocky Linux 8.x migration scenarios, run:

chmod u+x migrate2rocky.sh

And for the CentOS|Alma|RHEL 9.x to Rocky Linux 9.x migration scenarios, run: 

chmod u+x migrate2rocky9.sh

Execute the script

Now we’re getting to the fun part! It’s time to execute the script.

For the CentOS|Alma|RHEL 8.x to Rocky Linux 8.x migration scenarios, change to the root user with the command su and then type:

./migrate2rocky.sh -r

And for the CentOS|Alma|RHEL 9.x to Rocky Linux 9.x migration scenarios, change to the root user with the command su and then type:

./migrate2rocky9.sh -r

If successful, your terminal window should look like this for Rocky Linux 8:

And this for Rocky Linux 9:

how to migrate centos to rocky linux rocky9 1024x311

You know that you’ve successfully migrated to Rocky Linux If you see a Complete! message at the tail end of the script output. 

You can now safely restart your server. To ensure that you’ve successfully migrated to Rocky Linux, run the following command:

hostnamectl | grep System

how to migrate centos to rocky linux confirmation

Now it’s time to get to work! Download 10 Things to Do After You Download Rocky Linux to get started.

Related posts

2023 Holiday Gift Guide for Rocky Linux Users

2023 Holiday Gift Guide for Rocky Linux Users

Dec 19, 2023

Rocky Linux

Why Rocky Linux Is a Rock-Solid Choice in an Economic Downturn

Why Rocky Linux Is a Rock-Solid Choice in an Economic Downturn

Jan 18, 2023

Rocky Linux

6 Signs That It's Time to Move to Rocky Linux

6 Signs That It's Time to Move to Rocky Linux

Feb 23, 2023

Rocky Linux

123
53
>>>