Mastering yum update: Essential Commands, Options, and Troubleshooting for Linux
This tutorial explains how to use the yum update command on RPM‑based Linux systems, covering basic usage, repository handling, useful options like --nogpgcheck and --exclude, how to roll back updates, troubleshoot failures, and automate notifications with yum‑cron.
Introduction to yum update
Yum is the package manager for Red Hat, CentOS, and other RPM‑based Linux distributions. The yum update command upgrades all installed packages to the latest versions available in configured repositories.
$ yum updateHow yum update works
When executed, yum checks its repositories for newer versions of installed packages, lists the repositories being queried (e.g., AppStream, Base, Extras), and shows a transaction summary with the number of packages to be installed, upgraded, or added.
After reviewing the list, confirm the operation by typing y and pressing Enter. Yum then downloads and installs the updates, which may take time depending on network speed and system load.
Skipping GPG checks
The --nogpgcheck option disables GPG signature verification, useful when installing unsigned packages or when GPG keys are unavailable.
$ yum update --nogpgcheckUsing a local repository
To update from a local repository, place RPM files in a directory (e.g., /root/rpms) and create a repo file in /etc/yum.repos.d:
[MyRepo]
name=My Local Repo
baseurl=file:///root/rpms
enabled=1
gpgcheck=0Set proper permissions and clear the yum cache before updating:
$ chmod 644 MyRepo.repo
$ yum clean allDisplaying available patches
List security patches without installing them:
$ yum updateinfo list securityUpdating a single package
Specify the package name to update only that package (multiple packages can be listed separated by spaces):
$ yum update name-of-packageExcluding packages from updates
Use --exclude (or -x) to prevent specific packages, such as kernel packages, from being updated: $ yum update --exclude=kernel* Multiple exclusions can be combined:
$ yum update --exclude=kernel* --exclude=httpdRolling back an update
Each yum operation receives a transaction ID. To undo a recent update, find the ID with yum history and run:
$ yum history undo 7Cleaning failed updates
If duplicate packages appear after a failed update, remove them with: $ package-cleanup --dupes Always clear yum’s cache first if errors persist:
$ yum clean allSkipping broken dependencies
When dependency errors occur, continue updating other packages with:
$ yum update --skip-brokenListing available updates
Run yum update without options to see all available updates, or use yum list updates to list every package in the repositories, even those not installed.
$ yum list updatesDifference between yum check-update and yum list updates
yum list updatesshows all packages with available updates in the repos, while yum check-update only reports updates for packages already installed. yum check-update returns exit code 100 if updates exist, 0 if none, and 1 on error.
$ yum check-updateAutomatic update notifications (yum‑cron)
Install and enable yum-cron to receive email notifications about available updates:
$ yum install yum-cron
$ systemctl enable yum-cron.service
$ systemctl start yum-cron.serviceEdit /etc/yum/yum-cron.conf to configure email settings and whether updates should be applied automatically.
apply_updates = no
email_from = root@localhost
email_to = [email protected]
email_host = localhostNetwork port used by yum
Yum accesses repositories over HTTP, using port 80. Ensure the firewall allows traffic on this port for yum to function.
yum update vs. yum upgrade
Both commands fetch newer packages, but yum upgrade also removes obsolete packages, whereas yum update leaves them installed, making yum update the safer choice for most scenarios. $ yum upgrade Use yum upgrade with caution, as it may remove packages you still need.
Conclusion
This guide provides a comprehensive overview of the yum update workflow, useful options, troubleshooting steps, and automation techniques to keep RPM‑based systems up to date safely.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
