Updating/Patching your Linux Server

As a web hosting server admin, you want to keep your machine up-to-date. In RedHat/CentOS, you will use the yum tool to keep your packages updated.

What is yum?
yum is the primary tool for getting, installing, deleting, querying, and managing Red Hat Enterprise Linux RPM software packages from official Red Hat software repositories, as well as other third-party repositories. yum is used in Red Hat Enterprise Linux versions 5 and later. Versions of Red Hat Enterprise Linux 4 and earlier used up2date.

https://access.redhat.com/solutions/9934

To update your operating system packages:

1. Log in to SSH and switch to the root user

2. Clear the cached packages

yum clean all

On a cPanel server, the output will look like:

root@web [~]# yum clean all
Loaded plugins: fastestmirror, tsflags, universal-hooks
Cleaning repos: EA4 cpanel-addons-production-feed cpanel-plugins MariaDB103 base epel extras psrepo updates
Cleaning up list of fastest mirrors
Other repos take up 6.5 M of disk space (use --verbose for details)
root@web [~]#

3. Run the yum update command to update the packages

On one of our web hosting servers, the output is:

root@web [~]# yum update
Loaded plugins: fastestmirror, tsflags, universal-hooks
Determining fastest mirrors
epel/x86_64/metalink                                                                                                                             |  17 kB  00:00:00
 * EA4: 208.74.123.61
 * cpanel-addons-production-feed: 208.74.123.61
 * cpanel-plugins: 208.74.123.61
 * base: mirrors.unifiedlayer.com
 * epel: fedora-epel.mirror.lstn.net
 * extras: mirror.dc2.hackingand.coffee
 * updates: mirror.netdepot.com
EA4                                                                                                                                              | 2.9 kB  00:00:00
cpanel-addons-production-feed                                                                                                                    | 2.9 kB  00:00:00
cpanel-plugins                                                                                                                                   | 2.9 kB  00:00:00
MariaDB103                                                                                                                                       | 2.9 kB  00:00:00
base                                                                                                                                             | 3.6 kB  00:00:00
epel                                                                                                                                             | 5.3 kB  00:00:00
extras                                                                                                                                           | 2.9 kB  00:00:00
psrepo                                                                                                                                           | 2.9 kB  00:00:00
updates                                                                                                                                          | 2.9 kB  00:00:00
vz-base                                                                                                                                          |  951 B  00:00:00
vz-updates                                                                                                                                       |  951 B  00:00:00
(1/12): cpanel-addons-production-feed/x86_64/primary_db                                                                                          |  18 kB  00:00:00
(2/12): cpanel-plugins/x86_64/primary_db                                                                                                         |  30 kB  00:00:00
(3/12): MariaDB103/primary_db                                                                                                                    |  53 kB  00:00:00
(4/12): epel/x86_64/group_gz                                                                                                                     |  90 kB  00:00:00
(5/12): base/7/x86_64/group_gz                                                                                                                   | 165 kB  00:00:00
(6/12): EA4/7/x86_64/primary_db                                                                                                                  | 1.0 MB  00:00:00
(7/12): extras/7/x86_64/primary_db                                                                                                               | 153 kB  00:00:00
(8/12): psrepo/7/primary_db                                                                                                                      |  74 kB  00:00:00
(9/12): epel/x86_64/updateinfo                                                                                                                   | 1.0 MB  00:00:00
(10/12): base/7/x86_64/primary_db                                                                                                                | 6.0 MB  00:00:01
(11/12): updates/7/x86_64/primary_db                                                                                                             | 5.9 MB  00:00:01
(12/12): epel/x86_64/primary_db                                                                                                                  | 6.9 MB  00:00:01
(1/2): vz-base/primary                                                                                                                           |  723 B  00:00:00
(2/2): vz-updates/primary                                                                                                                        | 1.0 kB  00:00:00
vz-base                                                                                                                                                             1/1
vz-updates                                                                                                                                                          4/4
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be updated
---> Package epel-release.noarch 0:7-12 will be an update
---> Package kmod-libs.x86_64 0:20-23.el7 will be updated
---> Package kmod-libs.x86_64 0:20-25.el7 will be an update
---> Package yara.x86_64 0:3.8.1-1.el7 will be updated
---> Package yara.x86_64 0:3.11.0-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                    Arch                                 Version                                       Repository                          Size
========================================================================================================================================================================
Updating:
 epel-release                               noarch                               7-12                                          epel                                15 k
 kmod-libs                                  x86_64                               20-25.el7                                     base                                51 k
 yara                                       x86_64                               3.11.0-1.el7                                  epel                               213 k

Transaction Summary
========================================================================================================================================================================
Upgrade  3 Packages

Total download size: 278 k
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): epel-release-7-12.noarch.rpm                                                                                                              |  15 kB  00:00:00
(2/3): kmod-libs-20-25.el7.x86_64.rpm                                                                                                            |  51 kB  00:00:00
(3/3): yara-3.11.0-1.el7.x86_64.rpm                                                                                                              | 213 kB  00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   656 kB/s | 278 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : epel-release-7-12.noarch                                                                                                                             1/6
  Updating   : kmod-libs-20-25.el7.x86_64                                                                                                                           2/6
  Updating   : yara-3.11.0-1.el7.x86_64                                                                                                                             3/6
  Cleanup    : epel-release-7-11.noarch                                                                                                                             4/6
  Cleanup    : kmod-libs-20-23.el7.x86_64                                                                                                                           5/6
  Cleanup    : yara-3.8.1-1.el7.x86_64                                                                                                                              6/6
  Verifying  : yara-3.11.0-1.el7.x86_64                                                                                                                             1/6
  Verifying  : kmod-libs-20-25.el7.x86_64                                                                                                                           2/6
  Verifying  : epel-release-7-12.noarch                                                                                                                             3/6
  Verifying  : kmod-libs-20-23.el7.x86_64                                                                                                                           4/6
  Verifying  : yara-3.8.1-1.el7.x86_64                                                                                                                              5/6
  Verifying  : epel-release-7-11.noarch                                                                                                                             6/6

Updated:
  epel-release.noarch 0:7-12                             kmod-libs.x86_64 0:20-25.el7                             yara.x86_64 0:3.11.0-1.el7

Complete!
root@web [~]#

Resources:
Working with yum cache
yum command cheat sheet