RHEL 8/9 update installed packages for security

See all Redhat/CentOS/Fedora Core related FAQ
I would like to update installed packages for security on RHEL 8.x/9.x (Red Hat Enterprise Linux) server. How can I update my RHEL 8.x/9.x system using yum command or dnf command?

Keeping your system, kernel, and the installed application is an essential sysadmin task. An updated RHEL 8/9 system means fewer security issues and increased system stability. Red Hat Enterprise Linux 8.x is pretty user-friendly when it comes to applying updates and patches. This page shows how to update RHEL system using the yum command or the GUI tools for desktop installation.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux terminal
Category System Management
OS compatibility AlmaLinux Fedora RHEL Rocky Stream
Est. reading time 3 minutes

RHEL 8/9 update installed packages for security

The procedure to install updates on RHLE:

  1. Open the terminal app.
  2. For remote server log in using the ssh command:
    ssh user@server-name-here.
  3. Show information about update advisories, run:
    sudo yum updateinfo
  4. Issue the command sudo yum update to refresh package database and install updates.
  5. Reboot the system if kernel was updated by typing sudo reboot command.

Let us see all steps in details.

The yum command is a symlink to the dnf command for backwards compatibility reasons on RHEL 8/9, CentOS Stream and friends. Hence, you can use yum or dnf, and the syntax remains the same. Use the ls command to verify this:
$ ls -l /usr/bin/{yum,dnf}

lrwxrwxrwx. 1 root root 5 Mar 21 06:08 /usr/bin/dnf -> dnf-3
lrwxrwxrwx. 1 root root 5 Mar 21 06:08 /usr/bin/yum -> dnf-3

Find out info about available security-related updates

It is a good idea to find out if there any updates available for the box. Hence, run the following command:
$ sudo yum updateinfo
Sample outputs:

Last metadata expiration check: 0:17:14 ago on Monday 16 September 2019 07:01:29 PM UTC.
Updates Information Summary: available
     6 Security notice(s)
         6 Important Security notice(s)
    10 Bugfix notice(s)

Want to see a list of the updates on screen? Try the following command along with grep command or more/less command as a pager:
$ sudo yum check-update
$ sudo yum check-update | more
$ sudo yum check-update | grep bash
$ sudo yum check-update

Check for RHEL 8/9 software and security updates
Before you apply updates please note down Linux kernel version, run the following uname command:
$ uname -mrs
Sample outputs:

Linux 4.18.0-80.7.2.el8_0.x86_64 x86_64

How to install updates via yum command line for RHEL 8/9

Open up a terminal application or log in using ssh. Run the yum command to upgrade all installed packages on Red Hat Linux system:
$ sudo yum update
RHEL 8/9 Applying Security Updates Using yum
One can only apply security related updates to the machines, run:
$ sudo yum --security update
RHEL 8/9 update installed packages using yum

How do I update a single package?

Run the following yum command:
$ sudo yum update pkg_name
$ sudo yum update bash

It is also possible to install all updates except kernel and bash packages as follows:
$ sudo yum -x 'kernel*' -x 'bash*' update
The -x option exclude packages specified given name. See “Force yum update Command To Exclude Certain Packages” for more info.

Reboot the Linux system

You must reboot Linux system when RHEL 8.x or 9.x Linux kernel gets updated. Try using the shutdown command or reboot command as follows:
$ sudo reboot
Verify Linux kernel version and list updates after the server or workstation reboot:
$ uname -mrs
$ sudo yum updateinfo

Checking For and Updating Packages on RHEL 8 or 9

Checking for package updates on RHEL 8


You learned how to install the software update for all installed packages using the GUI and CLI methods on RHEL 8.x or 9.x based systems. See RHEL yum man page for more information or read it offline using the man command or help command as follows:
$ man dnf
$ man yum
$ dnf --help

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

1 comment… add one
  • Anonymous Jun 7, 2023 @ 18:40

    you are awesome as your content is!!!! Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.