In this article let us learn about the frequently used “yum update” command, see its meaning and understand its role and function in our Linux systems.
For those of you in a hurry, here is the short version of the answer
Short Explanation of “yum update” Command
What does “yum update” do?
The “yum update” command performs the following 2 steps
- It checks the versions of the presently installed software packages and checks if there are some newer versions available in the repositories.
- If there is some software for which a newer version is available, then the “yum update” command will update those software packages to their latest available versions.
Let us have a look at how the output of “yum update” looks like after the first step above is performed.
As you can see, there is a list of packages that gets printed on our screens, some are under the section “installing”, some are under the section “upgrading” and some are under the section “dependencies”.
The length of this list depends upon how much time has passed since the last time you have run the command “yum update” and how many packages have newer versions available on the repositories.
There are 5 columns in this list,
- package name, which is basically the name of the software
- the CPU architecture, whether this is built for 32-bit or 64-bit architecture
- version available
- repository name from which the package will be downloaded and
- the size of the downloadable package
In the end yum tells us the number of packages that have newer versions (the “Upgrade” line), the number of packages that will be newly installed (the “Install” line), and also shows us how much data will be downloaded. Then yum asks us if we wish to proceed.
Once we press “y” and press the “Enter/Return” button, yum will download and update all the listed software packages in our systems.
Don’t worry if you did not understand everything as this is just the short version of the answer.
The rest of the article gives more detailed explanations where we explore the answers to the following questions
- What is yum and what is the function of yum in our Linux systems?
- How does “yum update” do its job of updating packages?
- What are repositories and what do they contain?
- Why software in Linux comes in the form of packages? and
- What does a given software package contain other than the executable binary?
So, let us begin!
Detailed Explanation of “yum update” Command
Whenever you needed to install something on your Fedora machine and you went online and googled “how to install software X on Fedora”, you were probably led to a page that you some instructions like this
yum update yum install software_X
To become masters of our computers, we need to understand what goes into our computers! If you are a complete beginner to the concept of package management, I suggest you to first read my other article on package managers given in the link below.
A Beginners Introduction To Linux Package managers: apt, yum, dpkg & rpm
where I have explained the answer to the following questions
- what are packages in a Linux system?
- what are the contents of packages?
- 6 needs that package managers like yum fulfill and
- what are the functions of package managers?
If you are unfamiliar with the answers to the above questions, I suggest reading the article linked above, before continuing this one.
I hope you are now familiar with Package Management concepts! Let us get back to yum, and start by understanding what yum is and what its role is in our Linux Machines.
yum and its role in Linux
yum is an acronym that stands for yellowdog updater modified. (Named this way because yum’s ancestor is an open-source software called “yellowdog updater“, which was modified to create yum! )
If the software packages can be thought of as employees in an organization then you can think of yum as the “HR manager” who takes care of all the software packages (employees) in our system (organization).
The following are the 5 main tasks of yum
- install new software (hire new employees)
- remove unnecessary software (fire employees who are not needed anymore)
- update software (improve the skillset of employees)
- upgrade system (improve the entire organization, not just the employees) and
- maintain a database about software installed in our system (maintains the employee records!)
The “yum update” command does the 3rd duty in the above list. This duty is accomplished by yum, by performing the following steps.
- Step#1: check the internal database
- Step#2: check the repository database
- Step#3: update old packages
- Step#4: update the internal database
Let us learn each of these steps in more detail.
Step#1: Check the internal database
As we have seen in the article linked above, there is an internal database stored in our computers which contains information about all the software packages presently installed and the versions of each of the software package.
In our Fedora machines, this information is stored in the database called RPMDB (stands for RPM DataBase)
We can view this entire list by using the following command
$ yum list
This will display a very long list of packages, from A to Z, a part of which is shown in the screenshot below.
Let us take a closer look at one of these packages, the openssh-server, which is shown in the screenshot below.
As you can see there are 3 columns,
- column1: shows the package name (openssh-server.x86_64)
- column2: shows the version (8.5p1-2.fc4) and
- column3: shows the repository name (@anaconda)
If we are interested in one particular package, we can also get information about that particular package using the the command below
$ yum info openssh-server
and we will get the required information as shown in the screenshot below
Replace “openssh-server” with the package name you are interested in, to get info about that particular package!
So that ends the explanations for Step#1, let us go to the next step!
Step#2: Check the repository database
Repositories, simply put, are places on the internet where software is stored by the developers and maintainers of our distros.
The next step is to check the repository to see if any newer packages are available.
As we saw, yum knows which repository any given package came from, so yum will hop on to the internet, find the repo, and see if a newer version is available.
Step#3: Update old packages to newer versions
This step is simple, if a newer version is found, yum will update our older package into the newer one!
But what’s special about this step is the fact that yum does this for the very very long list of packages installed on our system, taking one package at a time, resolving any new dependencies introduced by the newer version, so that everything keeping working the way they are supposed to!
Step#4: Update the internal Database
Once a given package has been updated to a newer version yum will update the entry in the local database to keep everything in order!
So that is how “yum update” does its magic!
With that I will end this article!
Hope you have enjoyed reading this article as much as I enjoyed writing it!
Feel free to share this article with your friends and colleagues!
Here are some more articles that might interest you!