Step 1: Choose your target OS
For Red Hat Enterprise Linux (RHEL) compatibility, the two common choices are AlmaLinux and Rocky Linux. Both are free, community-governed rebuilds:- AlmaLinux: run by the non-profit AlmaLinux OS Foundation, with CloudLinux as a major sponsor. Since 2023 it targets application binary interface (ABI) compatibility with RHEL rather than an exact bug-for-bug copy. Supported by cPanel and CyberPanel.
- Rocky Linux: run by the Rocky Enterprise Software Foundation (RESF), founded by CentOS co-founder Gregory Kurtzer, with CIQ as a major sponsor. It aims to stay as close to RHEL as possible. Also supported by cPanel.
For the governance and release differences, see AlmaLinux vs. Rocky Linux.
Step 2: Take an inventory
Before you touch anything, record what the current server runs:- Packages:
rpm -qa | sort > packages.txt - Repositories: list third-party repos such as EPEL or Remi:
ls /etc/yum.repos.d/ - Application stack: the exact PHP, database and web server versions your application needs.
- Services and schedules:
systemctl list-unit-files --state=enabledand every user’scrontab -l.
Step 3: Deploy a test server
Don’t upgrade your production server in place first. Build a new one next to it:- Deploy a new FlashRDP Linux VPS. Login details are emailed on average in under 3 minutes.
- Choose AlmaLinux or Rocky Linux (9 or 10) from the available distributions.
- Harden it before moving any data: SSH keys, a firewall (
firewalld), and updates (dnf upgrade).
Step 4: Rehearse the migration
- Copy files: use
rsyncto copy your web root, configuration and database dumps from the CentOS server to the new one: - Restore SELinux contexts: AlmaLinux and Rocky Linux enforce SELinux by default. Relabel copied files instead of turning SELinux off:
- Test locally: edit the
hostsfile on your own computer to point your domain at the new server’s IP. - Validate: test the application end to end and watch the web server and application error logs.
Step 5: Cut over, with a rollback plan
- Lower the TTL: 48 hours before, set your DNS TTL to 300 seconds (5 minutes).
- Maintenance mode: put the live application into maintenance mode.
- Final sync: run
rsyncagain and import a fresh database dump. - Update DNS: point your A records to the new server.