How to Check and Install Updates On CentOS and RHEL?

Keeping your system up to date is essential for maintaining the security, stability, and performance of your CentOS or RHEL server. Cybercriminals constantly look for vulnerabilities in operating systems and software, making regular updates crucial to prevent data breaches and security exploits. Software updates also include bug fixes and enhancements that improve functionality and compatibility.

This guide covers how to check for and install updates on CentOS and RHEL using both Yum Package Manager (legacy) and DNF Package Manager (modern). You'll also learn how to set up automatic updates to streamline maintenance.

Checking for Updates

Before installing updates, you should check what packages have newer versions available. Both CentOS and RHEL support two package managers depending on the version.

Using Yum Package Manager

Yum (Yellowdog Updater Modified) was the default package manager in CentOS 6 and earlier versions. It automatically resolves dependencies and retrieves packages from configured repositories.

yum check-update

This command queries all configured repositories and lists available updates with details like package name, version, architecture, and repository source. The output shows:

  • Package Name The software package that can be updated

  • Version New version number available

  • Repository Source repository providing the update

  • Security updates Pay special attention to packages marked with security tags

Using DNF Package Manager

DNF (Dandified YUM) is the next-generation package manager that replaced Yum starting with CentOS 8. It offers improved performance, better dependency resolution, and parallel downloads.

dnf check-update

DNF's output is similar to Yum but includes epoch values (shown with colons) for better version comparison across releases. The output displays:

  • Repo column Repository providing each update

  • Package column All packages with available updates

  • Version details Current vs. available versions with epoch information

Installing Updates

Using Yum Package Manager

After identifying available updates, install them using the following command:

sudo yum update

Yum will display the list of packages to be updated and prompt for confirmation. After confirming with y, it downloads and installs updates with progress information including package names, versions, file sizes, and download progress.

To update specific packages only:

sudo yum update package-name

Using DNF Package Manager

DNF follows a similar process for installing updates:

sudo dnf update

DNF displays packages to be updated with version comparisons and prompts for confirmation. The installation process shows detailed progress similar to Yum, including package information and download status.

For specific packages:

sudo dnf update package-name

Setting Up Automatic Updates

Automatic updates ensure your system receives security patches and updates without manual intervention, saving time while maintaining security.

Using yum-cron for Automatic Updates

The yum-cron package enables scheduled automatic updates for Yum-based systems:

sudo yum install yum-cron

Configure automatic updates by editing /etc/yum/yum-cron.conf:

apply_updates = yes
download_updates = yes
update_cmd = default

Enable and start the service:

sudo systemctl start yum-cron
sudo systemctl enable yum-cron

Using dnf-automatic for Automatic Updates

For DNF-based systems, use dnf-automatic:

sudo dnf install dnf-automatic

Configure the service by editing /etc/dnf/automatic.conf:

[commands]
upgrade_type = default
apply_updates = yes

[emitters]
emit_via = email
email_to = root

Enable the automatic update timer:

sudo systemctl enable --now dnf-automatic.timer
sudo systemctl start dnf-automatic-install.timer

Best Practices

Practice Yum DNF
Security updates only yum update --security dnf update --security
Check without installing yum check-update dnf check-update
Download only yum update --downloadonly dnf update --downloadonly

Conclusion

Regular system updates are crucial for maintaining security and performance on CentOS and RHEL systems. Both Yum and DNF provide reliable methods to check for and install updates, while automatic update services like yum-cron and dnf-automatic ensure your system stays current without manual intervention. Choose the appropriate package manager based on your system version and configure automatic updates to maintain optimal security.

Updated on: 2026-03-17T09:01:39+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements