CentOS Linux Users: Where to Go From Here
In this article
If you're a CentOS Linux user, your next move depends on whether you need a drop-in replacement for CentOS 7/8 or you're ready to migrate to a newer platform. The short answer: for production servers, migrate to AlmaLinux or Rocky Linux (both are free, RHEL-compatible, and actively maintained); for desktops or newer features, consider Fedora or Debian. This guide walks you through the practical steps to transition smoothly.
What You'll Need
- A backup of your important data (configs, databases, files) – ideally a full system backup or snapshot.
- Root or sudo access to your CentOS system.
- An internet connection to download packages.
- If migrating to AlmaLinux or Rocky Linux, you'll need the migration script or a fresh install ISO.
Step-by-Step
- Assess your current setup. Run
cat /etc/centos-releaseto see your exact version. Note any custom repositories, third-party packages, or services that might be affected. - Back up everything. Use
tarorrsyncto copy critical directories (/etc,/var/www,/home, and any database dumps) to an external drive or another server. For databases, usemysqldumporpg_dump. - Choose your target distribution. For a direct CentOS replacement, pick AlmaLinux or Rocky Linux – both are binary-compatible with RHEL and support the same package manager (yum/dnf). For a more modern, rolling-release experience, Fedora works well for desktops. For a stable, community-driven server, Debian is another option, but it's not RHEL-compatible.
- If migrating to AlmaLinux or Rocky Linux: The easiest path is to use the official migration script. For AlmaLinux, download
almalinux-deployfrom the AlmaLinux wiki. For Rocky, usemigrate2rockyfrom the Rocky Linux GitHub. Run the script as root:sudo bash almalinux-deploy.shorsudo bash migrate2rocky.sh. These scripts replace CentOS repositories with the new ones and update the system. - If doing a fresh install: Download the ISO from the official website (AlmaLinux or Rocky), boot from it, and follow the installer. Choose the same partition layout and software selections as your old system to minimize disruption.
- After migration or install: Run
sudo dnf updateto ensure all packages are current. Check that your services start correctly:sudo systemctl status httpd(or your services). - Re-enable any third-party repositories. If you used EPEL, enable it again:
sudo dnf install epel-release. For other repos (like Remi or ELRepo), reinstall their RPMs from their official sites. - Test your applications. Run through your normal workflows – web server, database, cron jobs, etc. Verify that all services are running and data is intact.
Common Mistakes
- Skipping the backup. Even with a migration script, things can go wrong. Always have a backup.
- Using the wrong script. The AlmaLinux and Rocky scripts are specific to each distribution – don't mix them.
- Ignoring third-party repos. After migration, your old CentOS repos will be disabled; you must re-add any third-party ones manually.
- Assuming CentOS 7 packages work on newer versions. CentOS 7 is based on RHEL 7; AlmaLinux/Rocky 8 or 9 are based on RHEL 8/9. Some older packages may not be compatible – check for updates.
- Forgetting about SELinux. If you had SELinux enabled, ensure it's still enabled after migration. The migration scripts usually preserve it, but it's worth checking with
getenforce.
Tips
- Plan ahead. Choose a maintenance window to minimize downtime.
- Test on a non-production server first. If possible, clone your CentOS system and test the migration on the clone.
- Keep a bootable rescue disk. If the migration fails, you can boot from a live USB to recover data.
- Review your firewall rules. After migration, check
firewalldoriptablesto ensure your rules are still active. - Update your documentation. Note the new OS version and any command changes (e.g.,
yumis nowdnf, though both usually work).
Troubleshooting
- If the migration script fails: Check the log file it generates (often in
/var/log). Common issues include missing dependencies or network problems. Fix the issue and re-run the script. - If you can't boot after migration: Boot from a live USB, mount your root partition, and check the bootloader (GRUB). You may need to reinstall GRUB:
grub2-install /dev/sda(replace with your disk). - If services don't start: Check the status with
systemctl statusand look at logs withjournalctl -u. Often it's a missing dependency or a changed configuration path. - If you get GPG key errors: The new repositories have different keys. Run
sudo dnf clean alland thensudo dnf updateto refresh the cache. - If you're stuck on CentOS 7 and can't migrate: CentOS 7 reached end-of-life on June 30, 2024. You can still use the migration scripts, but you may need to manually update the repository URLs to the vault. For AlmaLinux, use the
almalinux-deployscript with the--convertoption.
Frequently Asked Questions
Is AlmaLinux or Rocky Linux a true drop-in replacement for CentOS?
Yes, both are designed to be binary-compatible with RHEL, meaning your CentOS packages and configurations will work without changes in most cases.
Can I migrate from CentOS 7 directly to AlmaLinux 9?
No, the migration script only supports upgrading within the same major version (e.g., CentOS 7 to AlmaLinux 8). To go to 9, you'd need to do a fresh install or perform a two-step migration (7→8, then 8→9).
What about CentOS Stream?
CentOS Stream is a rolling-release distribution that sits between Fedora and RHEL. It's not a drop-in replacement for CentOS Linux; it has a faster update cycle and may not be as stable for production.
Do I need to reinstall all my software after migrating?
No, the migration script preserves your installed packages. However, you may need to update some packages to versions available in the new repositories.
Is there any cost to using AlmaLinux or Rocky Linux?
No, both are free and open-source. They are community-supported and do not require a subscription.
What if I want to stay with Red Hat but don't want to pay?
You can use the Red Hat Developer Subscription for individuals, which is free for up to 16 servers, but you must register and accept the terms. For most users, AlmaLinux or Rocky is simpler.