Learn step by step to upgrade the package using YUM on the RHEL system. Insights into how the package upgrade process takes place in the background.
YUM is a Red Hat package manager who is capable of searching available packages, install, un-install packages and update them to the latest version. In this article, we are seeing how to update the package using YUM.
You should be having superuser privilege to perform YUM updates or you can use sudo, su for performing it with superuser privilege.
You can update the single package, multiple packages, or all available packages at once. Let’s see stepwise commands for the upgrade package using YUM.
1. Check for updates :
First of all, you can check for available updates using below command :
# yum check-update
Loaded plugins: amazon-id, rhui-lb, security
ConsoleKit.x86_64 0.4.1-6.el6 rhui-REGION-rhel-server-releases
ConsoleKit-libs.x86_64 0.4.1-6.el6 rhui-REGION-rhel-server-releases
Red_Hat_Enterprise_Linux-Release_Notes-6-en-US.noarch 8-2.el6 rhui-REGION-rhel-server-releases
abrt.x86_64 2.0.8-40.el6 rhui-REGION-rhel-server-releases
abrt-addon-ccpp.x86_64 2.0.8-40.el6 rhui-REGION-rhel-server-releases
abrt-addon-kerneloops.x86_64 2.0.8-40.el6 rhui-REGION-rhel-server-releases
------ output clipped -----
You will be presented with the list of packages with the available update. You can update one, multiple, or all packages at once. Dependencies during the update will be resolved and installed by YUM itself. You need not worry about them.
During any package update it goes through below steps :
- It checks if package update available or not
- It checks and resolves any dependencies
- It will present the user with updated information and seeks user confirmation to proceed
- Post confirmation it downloads the package from YUM server
- It installs/updates dependencies and package
- It cleans up stuff it created during the update
- It verifies package post-update
- Prints completion details screens and exits.
2. Update single package :
For single package update, you need to use the command yum update <package_name>
# yum update bash.x86_64
Loaded plugins: amazon-id, rhui-lb, security
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package bash.x86_64 0:4.1.2-33.el6_7.1 will be updated
---> Package bash.x86_64 0:4.1.2-41.el6_8 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Updating:
bash x86_64 4.1.2-41.el6_8 rhui-REGION-rhel-server-releases 909 k
Transaction Summary
=============================================================================================================================================================
Upgrade 1 Package(s)
Total download size: 909 k
Is this ok [y/N]: y
Downloading Packages:
bash-4.1.2-41.el6_8.x86_64.rpm | 909 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : bash-4.1.2-41.el6_8.x86_64 1/2
Cleanup : bash-4.1.2-33.el6_7.1.x86_64 2/2
Verifying : bash-4.1.2-41.el6_8.x86_64 1/2
Verifying : bash-4.1.2-33.el6_7.1.x86_64 2/2
Updated:
bash.x86_64 0:4.1.2-41.el6_8
Complete!
In the above example, we updated the bash package. You can see command also tried to check and resolve any dependencies for this update process.
3. Update multiple packages :
Multiple packages can be updated using the same command but supplying more than one package name at the end.
# yum update grep.x86_64 sudo.x86_64
Loaded plugins: amazon-id, rhui-lb, security
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package grep.x86_64 0:2.20-3.el6_7.1 will be updated
---> Package grep.x86_64 0:2.20-5.el6_8 will be an update
---> Package sudo.x86_64 0:1.8.6p3-20.el6_7 will be updated
---> Package sudo.x86_64 0:1.8.6p3-25.el6_8 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Updating:
grep x86_64 2.20-5.el6_8 rhui-REGION-rhel-server-releases 345 k
sudo x86_64 1.8.6p3-25.el6_8 rhui-REGION-rhel-server-releases 710 k
Transaction Summary
=============================================================================================================================================================
Upgrade 2 Package(s)
Total download size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): grep-2.20-5.el6_8.x86_64.rpm | 345 kB 00:00
(2/2): sudo-1.8.6p3-25.el6_8.x86_64.rpm | 710 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 2.3 MB/s | 1.0 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : grep-2.20-5.el6_8.x86_64 1/4
Updating : sudo-1.8.6p3-25.el6_8.x86_64 2/4
warning: /etc/sudoers created as /etc/sudoers.rpmnew
Cleanup : grep-2.20-3.el6_7.1.x86_64 3/4
Cleanup : sudo-1.8.6p3-20.el6_7.x86_64 4/4
Verifying : sudo-1.8.6p3-25.el6_8.x86_64 1/4
Verifying : grep-2.20-5.el6_8.x86_64 2/4
Verifying : grep-2.20-3.el6_7.1.x86_64 3/4
Verifying : sudo-1.8.6p3-20.el6_7.x86_64 4/4
Updated:
grep.x86_64 0:2.20-5.el6_8 sudo.x86_64 0:1.8.6p3-25.el6_8
Complete!
In the above example, we updated grep
and sudo
package using single command.
4. Updating all packages at once :
Sometimes you want to avoid the hassle of updating multiple packages and want to install all available updates in a single shot. Then you can go for yum update
command. Make a note that all related dependencies also gets installed/updated with this.
This is not recommended in a production environment unless you review the complete list of available updates thoroughly.
# yum update
----- output clipped -----
Transaction Summary
=============================================================================================================================================================
Install 3 Package(s)
Upgrade 243 Package(s)
Total download size: 237 M
Is this ok [y/N]: y
Downloading Packages:
(1/246): ConsoleKit-0.4.1-6.el6.x86_64.rpm | 83 kB 00:00
----- output clipped -----
Installed:
kernel.x86_64 0:2.6.32-642.15.1.el6 python-libipa_hbac.x86_64 0:1.13.3-22.el6_8.6
Dependency Installed:
libnl3.x86_64 0:3.2.21-8.el6
Updated:
ConsoleKit.x86_64 0:0.4.1-6.el6 ConsoleKit-libs.x86_64 0:0.4.1-6.el6
Red_Hat_Enterprise_Linux-Release_Notes-6-en-US.noarch 0:8-2.el6 abrt.x86_64 0:2.0.8-40.el6
abrt-addon-ccpp.x86_64 0:2.0.8-40.el6 abrt-addon-kerneloops.x86_64 0:2.0.8-40.el6
----- output clipped -----
You can see I had 243 updates available, 3 new packages were available and 1 dependency has to be installed for the update process.
We have seen above all manual steps to upgrade packages using YUM. In a case where you are comfortable with updating all packages on the system without checking the available list then you can use YUM crons as well which will automate the complete process for you.
YUM-cron is service available on RHEL which runs in background and updates packages on the system automatically. See the complete YUM-cron configuration here.
All outputs in this post are from RHEL 6.8 server.
Share Your Comments & Feedback: