Saturday, 21 September 2019

How to use yum command to update and patch Centos 7



Centos 7 is a major release of Centos release. Yum command can used to check latest updates and install security updates and patches on Centos systems from internet. Since, Centos 7 is major release of Centos the yum command can upgrade to the latest minor release (Centos 7.7).
Note: - Before updating operating system, take the backup of all critical data and configuration files.

Step 1. Run the following command the check the current installed version:

[root@linuxcloudy ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
[root@linuxcloudy ~]#

Step 2. Run the following commands to list all the latest updates:

[root@linuxcloudy ~]# yum check-updates
Loaded plugins: fastestmirror
…………………….
systemd-sysv.x86_64                                                                219-67.el7_7.1                                                                updates
teamd.x86_64                                                                       1.27-9.el7                                                                    base
tuned.noarch                                                                       2.11.0-5.el7_7.1                                                              updates
tzdata.noarch                                                                      2019b-1.el7                                                                   base
util-linux.x86_64                                                                  2.23.2-61.el7                                                                 base
vim-minimal.x86_64                                                                 2:7.4.629-6.el7                                                               base
xfsprogs.x86_64                                                                    4.5.0-20.el7                                                                  base
yum.noarch                                                                         3.4.3-163.el7.centos                                                          base
yum-plugin-fastestmirror.noarch                                                    1.1.31-52.el7                                                                 base
[root@linuxcloudy ~]#

Step 3 (Optional). Use –exclude option with yum update command, if any version dependencies and the latest version may impact the services.

[root@linuxcloudy ~]# yum update --exclude=<package name> -y

Step 4. Run the below command to update the system with latest minor release:

[root@linuxcloudy ~]# yum update –y
Loaded plugins: fastestmirror
…………………………….
Installed:
  kernel.x86_64 0:3.10.0-1062.1.1.el7

Dependency Installed:
  bind-export-libs.x86_64 32:9.11.4-9.P2.el7                                              geoipupdate.x86_64 0:2.5.0-1.el7

Updated:
  GeoIP.x86_64 0:1.5.0-14.el7                                NetworkManager.x86_64 1:1.18.0-5.el7_7.1                 NetworkManager-libnm.x86_64 1:1.18.0-5.el7_7.1
  NetworkManager-team.x86_64 1:1.18.0-5.el7_7.1              NetworkManager-tui.x86_64 1:1.18.0-5.el7_7.1             NetworkManager-wifi.x86_64 1:1.18.0-5.el7_7.1
  alsa-lib.x86_64 0:1.1.8-1.el7                              audit.x86_64 0:2.8.5-4.el7                               audit-libs.x86_64 0:2.8.5-4.el7
………………………………..
………………………………..
  systemd-libs.x86_64 0:219-67.el7_7.1                       systemd-sysv.x86_64 0:219-67.el7_7.1                     teamd.x86_64 0:1.27-9.el7
  tuned.noarch 0:2.11.0-5.el7_7.1                            tzdata.noarch 0:2019b-1.el7                              util-linux.x86_64 0:2.23.2-61.el7
  vim-minimal.x86_64 2:7.4.629-6.el7                         xfsprogs.x86_64 0:4.5.0-20.el7                           yum.noarch 0:3.4.3-163.el7.centos
  yum-plugin-fastestmirror.noarch 0:1.1.31-52.el7

Complete!
[root@linuxcloudy ~]#

Step 5. Reboot the system to boot from the new kernel:

[root@linuxcloudy ~]# reboot

Step 6. Once system is come up, run the following command to verify the Centos version:

[root@linuxcloudy ~]# cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)
[root@linuxcloudy ~]#

It’s done!!! Now Centos 7.6 is updated with Centos 7.7 release.

No comments:

Post a Comment