fbpx Updating the system using YUM
24/7/365 Support

Using YUM to update the CentOS

In this process, we will investigate the role of the Yellowdog Updater, Modified (YUM) package manager with regard to running a system update. Every once in a while, you may become aware of an update or may simply wish to discover if one exists. Applying patches and updates is a regular task for every server administrator, and an up-to-date system can help increase or ensure the security of your server as software bugs and vulnerabilities are found all the time and must be fixed promptly. In this process, you will learn how to achieve this with the help of YUM.

To Start With: What Do You Need?

To complete this process, you will require a working installation of the CentOS 7 operating system with root privileges, a console-based text editor of your choice, and a connection to the Internet in order to facilitate the download of additional packages.

The Process: 

You can run this process, as often as required but it should be done frequently, based on a schedule of your own choosing in the full knowledge that on occasion, some updates may
require a full system reboot:

  1. Log in as root and check whether there are any updates for your installed packages. To do this, log in and type the following:
    yum check-update
  2. If no updates are available, then the update process will end and no further work will need to be done. However, if updates are available, YUM will now return a list of all package updates from the repositories known to your system. To complete the update process, type the following command:
    yum -y update
  3. By using the -y flag, the preceding command will now bypass the need to confirm the transaction summary, and your system will now undergo an immediate update process. When complete, you will be provided with a final report that identifies what dependencies have been installed and what packages have been updated.
  4. Generally speaking, no further work is required and you may resume typical operations. However, if a new kernel has been installed, or an important security update has taken place, it may be necessary to reboot the system for the new changes to take effect. To do this, type the following:
    reboot

Note

While there is much debate as to whether an update will require a full system restart in practice, this is only to be considered after a kernel update, which is an update to glibc and particular security-based features that are activated during the boot process.

How Does It Work?

YUM is the default package management system for CentOS and part of its role is to automatically calculate what packages may require updating, what dependencies are required, and to manage the entire process of updating your system in a very simple way.

So, what have we learned from this experience?

We started the process by checking to see if any updates were available to our system using the yum command with the check-update option. In this way, YUM will now check a central repository to confirm if an update is applicable to our system. A repository is a remote directory or website that contains prepared software packages and utilities. YUM will use this facility to automatically locate and obtain the correct Red Hat Package Manager (RPM) and dependencies, and if an update is available, then YUM will respond accordingly with a full summary of what packages and dependencies are available. For
this reason, YUM is a very useful tool, and without doubt its mechanism does serve to simplify the processes associated with package management, because it can talk to repositories and this saves us from having to find and install new applications or updates
manually. If there are updates available, the output will show us exactly which packages are affected, then we can proceed to update the system by using YUM’s update parameter.

In this instance, the preceding command includes the -y flag. This is done in order to circumvent the need to agree with the transaction summary given, and to confirm that we have already agreed to make these updates after running the previous check. Otherwise, you would simply confirm the requests by using the Y key.

There’s more:

You can also use the update parameter to update single packages instead of the whole system by providing the package name like so: yum update package_name. YUM will serve to ensure that all of the requirements for an application are met during installation, and it will automatically install the packages for any dependencies that are not already present on your system. However, and I am sure you will be pleased to hear this, if a new application has requirements that conflict with existing software, YUM will abort the process without making any changes to your system. If you want to automate the updating of your system using a specific time interval, you can install the yum-cron package, which can be highly customized but is outside the scope of this book. To start after installation, use man yum-cron.

 

Help Category:

What Our Clients Say