“yum upgrade” Command Explained!

When I was a complete beginner and I needed to do something on my Fedora or CentOS machine, I frequently came across some commands which looked like this

yum upgrade

I was just happy that I was able to type something in the Terminal and it actually worked! I did not pay much attention to what I actually typed in. I guess to beginners, it just feels like a magic spell to get something installed!

As time went on, I gradually learned the meaning of this magic spell “yum upgrade” and that is what this article is going to be about.

For those of you in a hurry, let us look at the short version of the answer.

The Short Version of the Answer

What does “yum upgrade” do? The “yum upgrade” command makes our Linux machine to update all our packages along with their dependencies and then once done, go ahead and delete the outdated packages and outdated dependencies.

That is just the short version of the answer. For a complete beginner, the above answer might sound like you have understood 50% and the remaining 50% still isn’t clear. To understand the above lines 100% you need to first understand the answers to the following 6 questions,

  • What are packages in a Linux System?
  • What is present inside these packages?
  • What are package managers?
  • What are repositories? and
  • What are dependencies?
  • What is the need for package managers?

Once you have put together these 6 pieces of the puzzle, you will get the big picture of what exactly does “yum upgrade” do and what is going on in your Linux machine whenever you install or update software!

These terms “packages”, “repositories”, “dependencies” etc, are just some jargon used in the Linux world. The real meaning behind these are considerably simple concepts, so don’t let these “fancy terms” stop you from learning these concepts!

The Fundamentals

Before getting into the specifics of yum, we must be able to answer the question

How does commands work?

Here is video we made to answer this question.

Alright lets get back to the topic!

Piece#1/6: What are packages in a Linux System?

Let’s start with this most basic question. Linux OS is basically made up of 2 parts

  • The Linux Kernel and
  • Software packages that work with the Kernel to give us a complete Operating System

These packages can be application software like text editors, word processors, etc. or they can be the GNU utilities like bash, cron, dd, etc., or they can be device drivers to talk to the hardware. Everything other than the kernel is a package in Linux.

Next, let’s have a brief look at what is included in these “Packages”

Piece#2/6: What do these packages contain?

The content of the packages managed by these package managers involves the following 4 main components

  • Binaries or the executable programs
  • metadata files containing the version, dependencies, signatures and other relevant information
  • documentation and manuals
  • configuration files

By storing these components organized in a certain format, the entire process of installing, updating, and uninstalling software can be automated.

The tool that managers software in our system is called a Package Manager!

“YUM” is the package manager that your distro uses!

Piece#3/6: What is yum?

YUM stands for “Yellow-dog Updater Modified”. My guess is a person with a yellow dog made a software called yellow dog updater, and this software was later modified and used with our distro!

YUM is a tool that is used to manage software in our system. The words “manage software” simply refer to these 5 basic tasks

  • install software
  • remove software
  • upgrade software
  • upgrade system and
  • maintain the list of software that is installed in our system

This YUM tool is used is a long list of distros, if you are interested you can read which distros use these tools in my other article below!

Linux Distros That Uses Yum or DNF for Package Management

Next let us understand the meaning behind the jargon “repository”

Piece#4/6: What are repositories? 

Repositories (or repos for short) are basically a place where verified packages are stored for easy retrieval by the Package management tools like YUM. They can be online like the YUM repository or they can be on a local folder or a DVD where you have a special collection of software that you need.

Next let us look at our next jargon which is “Dependency”.

Piece#5/6: What are dependencies?

Any software you install is built on top of other software and hence they are dependent on the base software to be present in the system for them to run on top of.

That’s just the nature of the Software world. It’s just easier to build on top of an existing system than to reinvent the wheel each and every time!

For example, if you need to run a java-based application, then you need to have a Java Virtual Machine installed first. If you need to run python-based apps, then you need to have the python interpreter installed.

Now let us look at the last piece of the puzzle and try and answer the question of “What is the need for package managers?” so that we can complete our puzzle!

Piece#6/6: What is the Need for Package managers like yum?

During the early era of Linux, before we had these “package managers” installing software was a time-consuming process. The process goes something like this

  • Download the source code
  • Compile it
  • Take the produced binaries and put them in proper “bin” folders so that the operating system can find it when invoked
  • Take the documentation and put them in the “man” folder so that you can use the “man <package name>” command to get information about packages
  • Take the conf files and put them in “/etc/” folder so that you can change the settings and configuration of a tool when needed

As you night guess this process was really cumbersome and had a lot of problems as follows.

Problem#1. The Dependency Problem

Practically a given software can have tens and sometimes even hundreds of dependency packages. Trying to download and install all of these dependencies one by one can take hours to install a simple software. This posted a need for automating this process of downloading the dependencies along with the packages the end-user needs.

Problem#2. The Package Verification Problem

This is the second problem that needed to be solved while installing software. If you noticed carefully sometimes when you are downloading software, there will be some hex-code named “md5” or “SHA” on the download page. For ubuntu downloads, the screenshot below (link) shows such a code

If you click on the link marked by the red square you will be taken to a page which shows the hex-code like this (link)

These are produced by first signing the packages using some keys and then putting them through a hashing algorithm. These can be thought of as signatures used to verify that

  • the software you downloaded came through to your system in one piece without any damages from the ubuntu’s (canonical’s) server to your computer and
  • the software you downloaded is from the official provider so that you can be sure that there are no malware and other security issues with this software!

This means once downloading any package, you need to manually verify each package’s integrity before you go ahead and install them and verifying each package along with its dependent packages can become a time-consuming process. This is another area where smart automation can help.

Problem#3. The Uninstall Problem

Let’s say we decided to uninstall software since we don’t need it anymore so that we get more space in our hard disk to install more necessary packages. In the olden days, it meant manually going and deleting each of the binary and the dependencies. This can get cumbersome, especially if

  • a given package has too many dependencies
  • some of these dependencies were shared with other software.

This means deleting a dependency can result in some other software not working properly!

This again posted the need for a smart solution to keep track of software and its dependencies in the system!

Problem#4. The Updating Problem

Software developers come up with bug fixes and feature additions all the time and if you want the latest and greatest, you need to keep your system updated.

In olden days, updating package meant removing and reinstalling it, this basically means we have to jump through all the hoops mentioned above, using the latest version of the software to get things working again!

Problem#5. The Getting Info Problem

In the days before package managers, if you need to know which version of a particular software you are running, you need to look at your own records as there was no built-in system to make note of these details.

Problem#6. The Architecture Problem

Packages are compiled keeping in mind the specific processor architecture we use. A package compiled for a 64-bit system will not work on a 32-bit system. Another example is ARM processors vs Intel/AMD processor. A package compiled for AMD and Intel will not work on an ARM-processor based system. So the system administrator in olden days must also verify that the given package will work on their system!

Thankfully, lots of Linux developers chipped in to make this process of installing and managing software smoother than ever by writing these wonderful tools like YUM to manage our Packages!

Functions of YUM

Package managers like YUM serve the following functions to avoid the problems mentioned above

  • Automatically resolves dependencies by keeping track of what software is needed to make a package work
  • Verifies the integrity of the package before installing it
  • Uninstall and update with ease
  • Verifies the architecture compatibility
  • Keeps track of all the packages installed in the system so that the system administrator can easily get information about what packages are present, when was it installed, what version are they running in, etc.

Now that we have completed our Puzzle and understood the role of “yum” in Linux, let us have another look at the short answer again and see if we can understand everything!

YUM UPGRADE

The “yum upgrade” command makes our Linux machine to update all our packages along with their dependencies and then once done, go ahead and delete the outdated packages and outdated dependencies.

Hopefully when you read the above lines again, this time it made perfect sense!

And with that, I will conclude this article!

I hope you guys enjoyed this article and learned something useful. 

If you liked the post, feel free to share this post with your friends and colleagues!

Related Articles

Here are some of my other articles that might interest you!

A Step By Step Plan To Learn Linux..!

What Is The Best Linux Distro? Analysis & Comparison..!!

Best Linux Distro For Workstation: Analysis and Comparison!!

Distro-Hopping, What, Why & How Explained!

Reasons Behind The Existence of SO MANY Linux Distros: An Analysis!

Photo of author
Editor
Balaji Gunasekaran
Balaji Gunasekaran is a Senior Software Engineer with a Master of Science degree in Mechatronics and a bachelor’s degree in Electrical and Electronics Engineering. He loves to write about tech and has written more than 300 articles. He has also published the book “Cracking the Embedded Software Engineering Interview”. You can follow him on LinkedIn

Comments are closed.