To upgrade CentOS 7.5 to CentOS 7.9, you must first update the base system packages using yum, then install the centos-release package for version 7.9, and finally perform a full system upgrade with yum update. This process ensures all components align with the specific minor release version without jumping to newer major releases or unsupported versions.
Prerequisites and Preparation
Before initiating any major version change on a production server, it is critical to establish a reliable backup strategy. Upgrading the operating system involves replacing core libraries and kernel modules, which can occasionally lead to boot failures or application incompatibilities if not managed correctly. Ensure you have a recent snapshot of your virtual machine or a complete file system backup stored off-site. Additionally, verify that you have root access via SSH or console access to the physical machine, as network connectivity might be temporarily disrupted during the reboot phase. It is also important to check the current running kernel version. While CentOS 7.9 typically uses the same kernel family as 7.5, certain updates may push a newer kernel version. You should document your current configuration, including installed custom repositories and third-party software, to facilitate rollback if necessary. If your system relies on specific older versions of Python or other runtimes, note their dependencies carefully. For related maintenance tasks, such as securing remote access during upgrades, reviewing guides on Safely Upgrade OpenSSH on Remote Linux PCs (CentOS 6.7)? can provide useful context on handling service interruptions securely.Step 1: Update Existing Packages
The first step in the migration path from 7.5 to 7.9 is to bring your current installation up to the latest patch level within the 7.5 stream. This reduces the number of changes required when switching to the 7.9 repository metadata. Run the following command to synchronize your package database and apply all pending updates:yum update -y
This command will download and install all available security patches and bug fixes for CentOS 7.5. Depending on the age of your last update, this process may take some time. Once completed, it is highly recommended to reboot the system to ensure that the new kernel and updated libraries are loaded into memory. Use the standard shutdown command to restart:
reboot
After the system comes back online, verify that the services are running correctly and that you can reconnect via SSH. Check the OS release information again to confirm you are still on CentOS 7.5, but at the latest patch level for that minor version.
Step 2: Install the CentOS 7.9 Release Package
CentOS operates on a rolling release model within each major version, meaning the repository metadata points to the latest minor version by default. To force the system to target version 7.9 specifically, you need to install the release package that pins the version. This package contains the YUM repository configuration files that define where to fetch packages. Execute the following command to install the specific release package:yum install centos-release-7-9.2009.1.el7.centos.noarch.rpm
If you do not know the exact version string, you can search for available release packages:
yum list available | grep centos-release
Select the version corresponding to 7.9. Installing this package replaces the existing repository configuration files. It is crucial to note that simply installing this package does not immediately change your running system; it only changes where future package installations come from. The currently installed binaries remain at the 7.5 level until you explicitly trigger an update.
Step 3: Perform the Full System Upgrade
With the correct repository configured, you can now proceed to upgrade all installed packages to their CentOS 7.9 counterparts. This is the most intensive part of the process, as it involves updating the kernel, glibc, and various system utilities. Run the following command:yum update -y
During this process, YUM will resolve dependencies and may prompt you to accept GPG keys or replace obsolete packages. Review the transaction summary carefully before confirming. Pay attention to any warnings about conflicting packages or deprecated dependencies. If the system reports broken dependencies, you may need to manually resolve them or remove problematic third-party packages.
Once the download and installation phases complete successfully, you must reboot the system to load the new kernel and initialize the updated services. A clean reboot ensures that no old processes are holding onto outdated library files.
reboot
Verification
After the final reboot, verify that the system is running CentOS 7.9. You can check the version by viewing the release file:cat /etc/redhat-release
The output should read "CentOS Linux release 7.9.2009 (Core)". Additionally, check the kernel version:
uname -r
Ensure that all critical services are operational. Test application functionality that depends on specific system libraries. If you encounter issues, consult the system logs in /var/log/yum.log to see if any packages failed to install correctly.
Frequently Asked Questions
Can I skip directly from CentOS 7.0 to 7.9?
Yes, you can skip intermediate versions, but it is safer to update to the latest patch of your current minor version first. This minimizes the number of dependency conflicts that may arise during the major transition. Always ensure your system is fully patched before changing the release package.
What happens to my custom configurations during the upgrade?
Your configuration files in /etc are generally preserved unless a package update introduces a new default configuration format. In such cases, RPM may create .rpmnew files alongside your original configs. You should review these files after the upgrade to merge any necessary changes.
Is it safe to use yum update instead of rpm -Uvh?
Using yum update is the recommended method because it handles dependency resolution automatically. Manually using rpm requires you to manage dependencies yourself, which often leads to broken systems if packages are upgraded out of order. YUM ensures a consistent state across all installed software.
How do I roll back if the upgrade fails?
If the upgrade fails and the system becomes unstable, restore from your pre-upgrade backup or VM snapshot. There is no built-in "undo" button for OS version upgrades once the kernel and core libraries are replaced. Prevention through thorough backups is the only reliable recovery method.
Do I need to reinstall drivers after upgrading to 7.9?
In most cases, existing kernel modules will continue to work, especially if the kernel version remains similar. However, if the upgrade pulls in a significantly newer kernel, you may need to rebuild DKMS modules or reinstall proprietary drivers like NVIDIA CUDA. Check vendor documentation for compatibility notes.