IP2Free

How to Migrate CentOS or RHEL Systems to Rocky Linux

2026-02-13 05:55:35

Migrate2rocky Runbook: Convert CentOS and RHEL-like Systems to Rocky Linux

The migrate2rocky tool is the official community script designed to transform an existing Enterprise Linux (EL) installation into a fully functional Rocky Linux system. Unlike a fresh install, this process performs an in-place swap of repositories, branding, and packages, allowing you to maintain your data and configurations.


              Power your operations with LycheeIP


What does migrate2rocky change on a system?

The script is a surgical tool, not a blunt instrument. It identifies your current package set and replaces the "underlying plumbing" of the OS.

  • Repositories: It removes existing CentOS or RHEL-like .repo files and installs the Rocky Linux equivalents.
  • Branding: It updates release files (like /etc/os-release) and logos.
  • Packages: It reinstalls, upgrades, or downgrades packages as needed to ensure the system matches the Rocky Linux checksums.
  • What it is NOT: This is not a tool for "upgrading" major versions (e.g., it will not turn CentOS 7 into Rocky 9). It is for lateral moves within the same major version line.


Which systems are good candidates for an in-place conversion?

Not every server should be converted. Choosing the wrong candidate is the leading cause of Rocky Linux migration pitfalls.

Clean Baseline Criteria

  • The system is currently running a supported EL-family version (CentOS 8/9, AlmaLinux, or RHEL).
  • Storage is stable and has at least 2GB of free space for package caching.
  • The system is "vanilla", minimal custom kernel patches or manual binary overrides.

Red Flags: When to Reinstall Instead

If a system is heavily "pet-like" with undocumented manual changes, or if it is running on legacy hardware that won't support future versions, avoid the conversion. In these cases, it is safer to replatform using Rocky Linux Cloud Images and cloud-init.


              Power your operations with LycheeIP


 

Pre-migration Checklist: Preventing Rollback Scenarios

Before running the command, you must have a "Point of No Return" strategy.

  1. Snapshots/Backups: If virtualized, take a VM snapshot. If bare metal, ensure a full system backup is verified.
  2. Package Inventory: Run rpm -qa > pre-migration-packages.txt to have a record of every installed package.
  3. Third-Party Repo Triage: Disable or audit repos like EPEL, Remi, or vendor-specific repos. The script handles standard repos, but custom ones can cause dependency "flapping."
  4. Service Inventory: Document all running services. Migration sometimes restarts network or auth daemons.

How LycheeIP supports your migration window

During a maintenance window, your external data dependencies shouldn't be a variable. LycheeIP provides stable infrastructure that remains consistent regardless of your OS:

  • IP Whitelisting Persistence: Since LycheeIP allows up to 5 whitelisted IPs for static residential proxies, your server's identity remains recognized even after the OS branding changes.
  • Zero-Config Integration: Our proxies work at the protocol level (HTTP/S/SOCKS5), so your scraping or fintech scripts on Rocky Linux won't require a rewrite post-migration.
  • Global Reliability: With a 99.98% network uptime, you can focus on the migrate2rocky steps without worrying about losing your data stream connection.


How to run migrate2rocky safely in a maintenance window

Follow this sequence to execute the CentOS to Rocky Linux migration with precision.

1. Prepare the Script

Bash

curl -O https://raw.githubusercontent.com/rocky-linux/rocky/master/sig/core/bin/migrate2rocky.sh

chmod +x migrate2rocky.sh

2. The Dry Run (Optional but Recommended)

Some versions of the script allow for a check mode. If not, manually verify your repo connectivity: dnf check-update.

3. Execution

Run the script with the -r flag to actually execute the conversion:

Bash

sudo ./migrate2rocky.sh -r

Operator Check: Watch the output for "reinstalling" or "downgrading" messages. If you see persistent 404 errors, stop and check your DNS/Gateway settings.

4. The Reboot

A reboot is required to initialize the new Rocky Linux kernel and update the GRUB bootloader.

 

Post-migration: Confirming the system is truly Rocky

Once the system is back online, you must perform post-migration validation Rocky Linux tests.

  • Identity Check: cat /etc/redhat-release should now show "Rocky Linux release X.X".
  • Repo Sanity: dnf repolist should only show Rocky-related repositories (plus any third-party ones you re-enabled).
  • Kernel Verification: uname -a should show the Rocky-built kernel.
  • Service Audit: Check your most critical services. Did systemd units start as expected?

After confirming stability, your next step is to apply cybersecurity baselines. We recommend following our guide on Hardening Rocky Linux with OpenSCAP and CIS benchmarks.

 

               Power your operations with LycheeIP



Where do teams get burned?

  • Custom Kernels: If you are running a custom RT (Real-Time) kernel or a specialized vendor kernel, migrate2rocky may fail to replace it, leading to a hybrid system.
  • DKMS Modules: Drivers for specialized hardware (GPUs, 100G NICs) may need to be recompiled against the new Rocky kernel headers.
  • SELinux Contexts: While the script attempts to relabel, it’s good practice to run touch /.autorelabel if you encounter "Permission Denied" errors post-reboot.


When to avoid "Direct to 10.1" conversions


You cannot use migrate2rocky to jump from CentOS 7 to Rocky Linux 10.1. Major version transitions require a reinstall. Additionally, before considering a move to the 10.x line, you must validate your x86-64-v3 compatibility to ensure your hardware is supported by the newer kernel.

Troubleshooting Table

Error/IssueLikely CauseFix
Mirror sync errorDNS or Firewall blocking Rocky reposCheck /etc/resolv.conf and port 443.
Conflicting packagesLeftover third-party dependenciesManually remove the offending package and re-run.
Boot failureGRUB did not update correctlyBoot from ISO, enter Rescue Mode, and re-install GRUB.
 


Assumptions & Limitations

  • Assumes the user is migrating between equivalent major versions (e.g., 8.x to 8.x).
  • Assumes a stable internet connection is available to download new packages.
  • The script requires root or sudo privileges.

                   Power your operations with LycheeIP


Frequently Asked Questions

1. Is migrate2rocky officially supported?

It is the community-supported tool provided by the Rocky Linux project. While highly reliable, it is used at your own risk.

2. How long does the migration take?

On a standard server with a fast internet connection, the process usually takes 10 to 20 minutes.

3. Does it delete my data?

No. The script only modifies system-level packages, repositories, and branding. However, backups are mandatory.

4. Can I migrate back to CentOS?

There is no "undo" script. To go back, you would need to restore from the snapshot you took before starting.

IP2free