CentOS 7 /RHEL7: How To Check And Upgrade Packages Using YUM

Yum is a high level package managers like apt-get and smart. you can use YUM to install  new packages, remove old packages or check if packages has any updates in your system.

In this post, I will show you how to:

#1 YUM checking which installed Packages have any updates on your system

#2 YUM updating package for a single package

#3 YUM updating Packages for multiple packages

#4 YUM updating Packages for all packages

From manual page of “yum”:

yum  is an interactive, rpm based, package manager. It can automatically perform system updates, including dependency analysis and obsolete processing based on “repository”  metadata.  It  can  also  perform installation of new packages, removal of old packages and perform queries on the installed and/or available packages among many other commands/services (see below). yum is similar to other high level package managers like apt-get and smart.

CentOS 7 YUM Checking Updates

If you want to see if there are packages available for an update on centos 7 system, issue the following “yum” command with “check-update” option.

yum check-update

Outputs:

[root@devops Desktop]# yum check-update
Loaded plugins: fastestmirror, langpacks
base                                                                           | 3.6 kB  00:00:00
extras                                                                         | 3.4 kB  00:00:00
updates                                                                        | 3.4 kB  00:00:00
updates/7/x86_64/primary_db                                                    | 4.8 MB  00:00:22
Loading mirror speeds from cached hostfile
* base: mirrors.nwsuaf.edu.cn
* extras: mirrors.nwsuaf.edu.cn
* updates: mirrors.nwsuaf.edu.cn
NetworkManager.x86_64                               1:0.9.9.1-29.git20140326.4dba720.el7_0     updates
NetworkManager-glib.x86_64                          1:0.9.9.1-29.git20140326.4dba720.el7_0     updates
NetworkManager-tui.x86_64                           1:0.9.9.1-29.git20140326.4dba720.el7_0     updates
abrt.x86_64                                         2.1.11-12.el7.centos.0.1                   updates
abrt-addon-ccpp.x86_64                              2.1.11-12.el7.centos.0.1                   updates
abrt-addon-kerneloops.x86_64                        2.1.11-12.el7.centos.0.1                   updates
abrt-addon-pstoreoops.x86_64                        2.1.11-12.el7.centos.0.1                   updates
abrt-addon-python.x86_64                            2.1.11-12.el7.centos.0.1                   updates
abrt-addon-vmcore.x86_64                            2.1.11-12.el7.centos.0.1                   updates
abrt-addon-xorg.x86_64                              2.1.11-12.el7.centos.0.1                   updates
abrt-cli.x86_64                                     2.1.11-12.el7.centos.0.1                   updates
abrt-console-notification.x86_64                    2.1.11-12.el7.centos.0.1                   updates
abrt-dbus.x86_64                                    2.1.11-12.el7.centos.0.1                   updates
abrt-desktop.x86_64                                 2.1.11-12.el7.centos.0.1                   updates
abrt-gui.x86_64                                     2.1.11-12.el7.centos.0.1                   updates
abrt-gui-libs.x86_64                                2.1.11-12.el7.centos.0.1                   updates
abrt-libs.x86_64                                    2.1.11-12.el7.centos.0.1                   updates
abrt-python.x86_64                                  2.1.11-12.el7.centos.0.1                   updates
abrt-tui.x86_64                                     2.1.11-12.el7.centos.0.1                   updates
at.x86_64                                           3.1.13-17.el7_0.1                          updates
...

It will print all packages that have an update available. and the output will also show you the name of package have updates available, the version of installed package.

If you just want to see one particular package if there is a update, just appending the package name to “yum check-update” command. such as, Yum checking wget package update:

root@devops Desktop]# yum check-update wget
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.nwsuaf.edu.cn
* extras: mirrors.nwsuaf.edu.cn
* updates: mirrors.nwsuaf.edu.cn
wget.x86_64                                  1.14-10.el7_0.1                                   updates
[root@devops Desktop]#

If you can see “updates” string, it indicated that this package have a update.

CentOS 7 YUM Updating A Single Package

After checking the update for installed package on your system, you should be want to update it to the latest version. to update a single package, issue the following command:

yum update <package name>

Example: yum updating wget package

Firstly, checking the current version of wget package

[root@devops Desktop]# rpm -qa | grep wget
wget-1.14-10.el7.x86_64

Then, updating wget package using “yum update wget” command

[root@devops Desktop]# yum update wget

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirrors.nwsuaf.edu.cn

* extras: mirrors.nwsuaf.edu.cn

* updates: mirrors.nwsuaf.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package wget.x86_64 0:1.14-10.el7 will be updated

---> Package wget.x86_64 0:1.14-10.el7_0.1 will be an update

--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================

Package            Arch                 Version                          Repository             Size

======================================================================================================

Updating:

wget               x86_64               1.14-10.el7_0.1                  updates               545 k

Transaction Summary

======================================================================================================

Upgrade  1 Package

Total download size: 545 k

Is this ok [y/d/N]: y

Downloading packages:

updates/7/x86_64/prestodelta                                                   | 218 kB  00:00:03

Delta RPMs reduced 545 k of updates to 253 k (53% saved)

wget-1.14-10.el7_1.14-10.el7_0.1.x86_64.drpm                                   | 253 kB  00:00:01

Finishing delta rebuilds of 1 package(s) (545 k)

warning: /var/cache/yum/x86_64/7/updates/packages/wget-1.14-10.el7_0.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Importing GPG key 0xF4A80EB5:

Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"

Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5

Package    : centos-release-7-0.1406.el7.centos.2.3.x86_64 (@anaconda)

From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Is this ok [y/N]: y

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Updating   : wget-1.14-10.el7_0.1.x86_64                                                        1/2

Cleanup    : wget-1.14-10.el7.x86_64                                                            2/2

Verifying  : wget-1.14-10.el7_0.1.x86_64                                                        1/2

Verifying  : wget-1.14-10.el7.x86_64                                                            2/2

Updated:

wget.x86_64 0:1.14-10.el7_0.1

Complete!

CentOS 7 YUM updating Packages for multiple packages

If you want to update multiple packages at the same time, just appending packages names to “yum update” comand, just like the following format:

yum update <package name1> <package name2>

Example, yum updating wget and samba-client, issue the following command:

yum update wget samba-client

CentOS 7 YUM updating Packages For All Packages

If there are lots of packages that have update available, you must  be want know if there is a way to update it at once .  Of course, the answer is yes. just simply issue “yum update” command without any options.

yum update

Outputs:

[root@devops Desktop]# yum update

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirrors.nwsuaf.edu.cn

* extras: mirrors.nwsuaf.edu.cn

* updates: mirrors.nwsuaf.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package NetworkManager.x86_64 1:0.9.9.1-13.git20140326.4dba720.el7 will be updated

---> Package NetworkManager.x86_64 1:0.9.9.1-29.git20140326.4dba720.el7_0 will be an update

---> Package NetworkManager-glib.x86_64 1:0.9.9.1-13.git20140326.4dba720.el7 will be updated

---> Package NetworkManager-glib.x86_64 1:0.9.9.1-29.git20140326.4dba720.el7_0 will be an update

---> Package NetworkManager-tui.x86_64 1:0.9.9.1-13.git20140326.4dba720.el7 will be updated

---> Package NetworkManager-tui.x86_64 1:0.9.9.1-29.git20140326.4dba720.el7_0 will be an update

---> Package abrt.x86_64 0:2.1.11-12.el7.centos will be updated

---> Package abrt.x86_64 0:2.1.11-12.el7.centos.0.1 will be an update

---> Package abrt-addon-ccpp.x86_64 0:2.1.11-12.el7.centos will be updated

...

--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================

Package                                  Arch   Version                                Repository

Size

======================================================================================================

Installing:

kernel                                   x86_64 3.10.0-123.9.3.el7                     updates  29 M

kernel-devel                             x86_64 3.10.0-123.9.3.el7                     updates 8.9 M

Updating:

NetworkManager                           x86_64 1:0.9.9.1-29.git20140326.4dba720.el7_0 updates 1.4 M

NetworkManager-glib                      x86_64 1:0.9.9.1-29.git20140326.4dba720.el7_0 updates 370 k

NetworkManager-tui                       x86_64 1:0.9.9.1-29.git20140326.4dba720.el7_0 updates 191 k

...

Transaction Summary

======================================================================================================

Install    2 Packages (+1 Dependent package)

Upgrade  213 Packages

Total download size: 333 M

Is this ok [y/d/N]:

It may be take a while to updating all package …..

done…

You might also like:

Sidebar



back to top