Updating base packages

In this exercise you will configure a local software repository for the packages already installed on the compute nodes to update them. As we saw in the previous section, the creation of the local repository consist of three main steps:

  • Create the folder for the repository

  • Download a set of rpms into the repository folder

  • Create and populate the repository database (createrepo command)

Let’s begin creating the folder /var/www/html/minimal in the master node. Then, in order to know the list of packages to be downloaded, capture a list of the packages already installed in one compute node. For instance for node c01 (commands in master):

[root@master ~]# mkdir minimal
[root@master ~]# cd minimal
[root@master minimal]# ssh c01 yum list installed | awk 'NR > 1 {print $1}'  > names.rpms

Note that without | awk 'NR > 1 {print $1}' the command will show the name and version for all packages, plus a header. In our case, as we want to update the system, names are enough. Now, download the packages in the names.rpms file.

[root@master minimal]# yumdownloader `cat names.rpms`

Finally, create and populate the repository database:

[root@master minimal]# createrepo .

Let’s now ssh into a compute node and use the minimal repository to update the system, for instance for node c01:

[root@master ~]# ssh c01
[root@c01 ~]# yum update

will show No packages marked for update:

[root@c01 ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
core-0                          | 3.6 kB  00:00:00
No packages marked for update

Once again, as in The Smallest Example is explained, the repository can be used on the compute nodes by adding the necessary .repo file containing:

[root@c01 yum.repos.d]# cat minimal.repo
[minimal]
name=minimal
baseurl=http://192.168.16.1/minimal
enabled=1
gpgcheck=0
priority=1

in /etc/yum.repos.d/. After this procedure is complete, the yum update command will now show new updates, meaning that the updated packages from minimal overwrite the older ones in core-0.

[root@c01 ~]# yum update
minimal                                            6.8 MB/s | 850 kB     00:00
Dependencies resolved.
===================================================================================
Package                    Arch   Version                           Repo     Size
===================================================================================
Installing:
kernel                     x86_64 4.18.0-553.54.1.el8_10            minimal  10 M
Upgrading:
NetworkManager             x86_64 1:1.40.16-19.el8_10               minimal 2.3 M
NetworkManager-libnm       x86_64 1:1.40.16-19.el8_10               minimal 1.9 M
NetworkManager-team        x86_64 1:1.40.16-19.el8_10               minimal 160 k
NetworkManager-tui         x86_64 1:1.40.16-19.el8_10               minimal 355 k
autofs                     x86_64 1:5.1.4-114.el8_10.3              minimal 719 k
bind-libs                  x86_64 32:9.11.36-16.el8_10.4            minimal 176 k
...

Transaction Summary
===================================================================================
Install    3 Packages
Upgrade  122 Packages

Total download size: 676 M
Is this ok [y/N]: y

Note

If no pakages were found for update, try to rebuild the yum cache by running yum makecache