To update all installed packages for security on CentOS 8/9, you can use the dnf
package manager.
sudo dnf check-update
This will download the latest package repository information from the configured package sources.
dnf upgrade --security
command. This will update all packages that have security updates available:sudo dnf upgrade --security
dnf upgrade
command without the --security
flag:sudo dnf upgrade
This will update all installed packages to the latest available version.
Note: Before running the update commands, you may want to review the list of packages that will be updated by using the
dnf updateinfo list updates
command. This will show you a list of all available updates, along with a description of each update.
After running the update commands, you may need to reboot your system in order for the updates to take effect. You can use the reboot
command to reboot the system, or you can reboot manually by shutting down and restarting the system.
It's a good idea to regularly update your system to ensure that you have the latest security fixes and other updates installed. You can set up automatic updates using the dnf-automatic
package, which will automatically download and install updates on a schedule that you specify.