CentOS to Oracle Linux: Live Migration with Near-Zero Downtime
CentOS 7 has long served as a stable base for production deployments. Since Red Hat repositioned CentOS as an upstream (CentOS Stream), organizations requiring long-term stability and patch predictability face a pressing decision: which distribution steps in for workloads expecting RHEL compatibility, with minimal fuss? Oracle Linux remains a drop-in replacement—same ABI, compatible kernel options, and access to enterprise support—without licensing friction.
But theory doesn't reboot a data center. Migrating in-place, without incurring application downtime, exposes practical hurdles—dependency drift, service disruption, and leftover CentOS artifacts. The following is a carefully tested workflow for seamless CentOS 7 to Oracle Linux migration, avoiding risky piecemeal upgrades or costly reinstallation.
Preparation: Before You Touch Packages
1. Snapshot or Backup
Any workflow that says “no risk” is misleading. Full system backups, Btrfs/LVM snapshots, or VM-level clones are non-negotiable.
Example:
For an LVM root volume, create a snapshot first:
lvcreate --size 5G --snapshot --name snap_root /dev/centos/root
If using VMs, hypervisor snapshots give the fastest rollback.
2. Privilege and Connectivity
Migration will demand persistent root. Remote SSH sessions can disconnect during package replacements—run via a multiplexed session (e.g., tmux/screen).
3. Repo and Local Package Audit
Identify non-standard repos:
grep enabled /etc/yum.repos.d/*.repo | grep 1
Document any 3rd-party or local RPM sources. Custom package pins might break after repository replacement.
4. Staging Environment?
De-risk production by reproducing its package and service configuration on a staging VM first. Many edge cases only surface in context.
5. Baseline Update
On CentOS 7:
yum clean all
yum update -y
reboot
Reboots should be clean; any persistent boot or fsck error is a red flag.
Stepwise Migration: From CentOS 7 to Oracle Linux 7
Confirm Current System Signature
cat /etc/centos-release
# Expected: CentOS Linux release 7.9.2009 (Core)
If /etc/centos-release
does not exist as expected, resolve before proceeding.
Switch Out CentOS Repositories
Remove Legacy Repo Definitions:
rm -f /etc/yum.repos.d/CentOS-*.repo
rm -f /etc/yum.repos.d/epel.repo # (optional, will want to refresh EPEL after)
Install Oracle Linux Repo Config:
yum install -y https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oraclelinux-release-el7-1.0-14.el7.x86_64.rpm
# OL8/OL9 URLs: see https://yum.oracle.com/ for specifics.
Check /etc/yum.repos.d/
for new oracle-linux*.repo
files.
Remove CentOS Branding & Conflicts
Force-removal of branding/meta-packages—otherwise you'll battle conflicts during sync:
rpm -e --nodeps centos-release
# Side effect: this can cause spurious “no RPM provides CentOS-7” errors if scripts or crons expect that file—resolve post-migration.
Check for stragglers:
rpm -qa | grep centos
Manually handle or note anything essential.
Distro-Sync: Force All Packages onto Oracle Equivalents
This is the most critical phase.
distro-sync will downgrade or upgrade packages as necessary, aligning everything to Oracle's repos.
yum clean all
yum distro-sync -y
Potential error:
Transaction check error:
file /usr/lib/os-release from install of oraclelinux-release conflicts with file from package centos-release
If encountered, ensure centos-release
was successfully removed.
Check migration result:
cat /etc/os-release
# Look for: ID="ol", NAME="Oracle Linux Server"
Grub & Bootloader Consistency
In mixed-kernel environments (e.g., Oracle’s UEK + Red Hat Compatible Kernel), confirm bootloader points to the desired kernel:
grub2-mkconfig -o /boot/grub2/grub.cfg
For UEFI hosts:
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
Known issue: On certain cloud images, GRUB paths may be vendor-customized; check /boot/efi/EFI/
contents.
Validate available kernels:
awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
Service and Kernel Checks
Post-reboot, confirm Oracle’s kernel is active. UEK (Unbreakable Enterprise Kernel) is expected for enhanced features:
uname -r
# Example: 5.4.17-2136.307.3.el7uek.x86_64
Restart and validate daemon status for web, DB, and network services:
systemctl restart httpd
systemctl status httpd
journalctl -xe | tail -30
Tip: Some kernel modules (e.g., proprietary drivers) may not autoload—check lsmod
before and after.
Automating (Oracle-Provided) via Script: oracle-linux-deploy.sh
For CentOS 7, Oracle offers an official script. Caution: always review the fetched script’s content prior to execution.
curl -O https://yum.oracle.com/oracle-linux-deploy.sh
bash oracle-linux-deploy.sh
Side note: This method won’t cover custom repo or out-of-tree kernel module issues.
Operational Considerations for Uptime
- Clustered/Load-balanced setups: Migrate one node at a time; verify traffic draining on each.
- VM Environments: Always snapshot before operation. Some clouds (Oracle Cloud, AWS, etc.) offer instance-level recovery.
- Maintenance Windows: Even with zero-downtime aims, communicate planned windows—unexpected regressions can force reboots.
- Roll-back: Keep snapshots for at least one patch cycle.
Post-Migration Tasks
-
Clean up obsolete
.repo
or/etc/centos-release
files. -
Install Oracle’s support/OLCNE tooling if needed:
yum install oraclelinux-release-el7 oracle-olcne-release-el7 oracle-support-release-el7 -y
-
Optional: register the system with Oracle ULN for support and errata.
-
Re-enable EPEL or custom repos as necessary (using new EPEL repo files).
Example: Apache Web Server Real-World Migration
Given /etc/httpd/
, /var/www/html
production directories on CentOS 7:
Backup:
tar czvf /root/httpd-backup-$(date +%F).tar.gz /etc/httpd /var/www/html
After repository and kernel sync, check:
systemctl restart httpd
systemctl status httpd
curl -i http://localhost/
Typical error if SELinux labels shift:
AH00526: Syntax error on line 46 of /etc/httpd/conf/httpd.conf
Resolve via:
restorecon -Rv /etc/httpd /var/www/html
Gotcha: Some third-party monitoring agents (Datadog, Zabbix) pin against /etc/centos-release
—ensure scripts reference /etc/os-release
for future compatibility.
Final Thoughts
In-place migration from CentOS 7 to Oracle Linux is reliable, provided all steps—especially repo switch and distro-sync
—execute cleanly. Always validate post-migration kernel version and (critically) validate all application services start and log as expected. The overhead is on pre-migration audit and rollback—both far preferable to after-hours incident response.
Alternative tooling (e.g., converting to Rocky or AlmaLinux) exists, but Oracle Linux migration demonstrates no substantive technical blockers when RHEL ABI compatibility is required.
For more specialized cases (e.g., large clusters, stateful container hosts), further automation and custom playbooks are advisable. As always: test, back up, migrate, and verify.
(End of guide: practical, not perfect—document your own caveats as you go.)