If you are confused about which command to use to update Linux packages, this article is for you. Here, I have explained two update commands: yum update and upgrade to update packages. Yum update basically updates all the installed packages to the modern version available in the repository and the yum upgrade command does a complete upgrade but more aggressively which may lead to breaking your system. Therefore, which one you should choose to complete your desired task? To clear out the confusion keep reading the ‘yum update vs upgrade’ article.
Key Takeaways
- Knowing about Yum package manager.
- Knowing the differences between Yum update vs upgrade.
- Learning about how to use these commands in Linux distro.
Requirements
- Must be a root user to avail of sudo privileges.
- Must be registered in a Red-hat-based
What Is Yum?
Yum refers to the Yelowdog Updater Modified which is an efficient package manager. It is used to install, remove, update, or upgrade packages in Linux. Moreover, dependency resolution is another vital task of this package manager. This package manager can remove or replace unnecessary dependency from packages that make the working ecology healthier and more secure. Red-hat-based Linux distros such as RHEL, CentOS, and Fedora mostly use this Yum package manager.
What Are Packages in Linux?
Basically, the Linux system consists of 3 major parts. They are:
- Linux Hardware
- Linux Kernel
- Software Packages
Hardware is the physical part of the Linux computer that we can touch by our hand like SSD, RAM, ROM, CPU, Hard Disk, etc.
Kernel presents the interface between hardware and software. It connects the hardware system to the software packages.
Lastly, software packages are usually application software like word processors, Photo editors, Video editors, etc. Linux utilities including bash and cron can act as a driver between software and hardware.
Now, let’s know about the contents of the packages.
Package Contents in Linux
Packages contain several contents. Some of the main parts are as follows:
- Binaries
- Configuration files
- Metadata (version, signatures, dependencies, etc.)
- Manuals
Packages including these contents are stored in system repositories. Let’s know about the repositories in Linux.
What Does Repositories Mean in Linux?
Repositories actually mean the location where software packages remain. It can be online or offline/local, or a DVD for storing packages. Yum is a kind of online repository where packages are stored with versions, signatures, and all other relevant package information. From the repository, you can easily install, retrieve, or update packages, therefore repository is essential for software packages.
What Does Yum Update Do?
Yum update usually updates all installed packages by disabling the –obsolete flag which means no obsolete packages will be removed from the Linux system during an update operation. It will only update the existing packages. Hence, this command helps to improve computer performance by updating the packages to their recent versions available in the repositories. Additionally, it resolves the dependency issues while updating packages.
What Does Yum Upgrade Do?
Yum upgrade is a more active command than yum update. Unlike the Yum update, it can remove obsolete packages from your Linux system. Actually, it operates an updating procedure by setting the –obsolete flag=1. Therefore, any packages that seem no longer required by the yum package manager, will be removed automatically after executing the yum upgrade command.
Yum Update Vs Upgrade
To know the basic differences between yum update vs upgrade, go through the following table:
Yum Update | Yum Upgrade |
---|---|
The Yum update command is used to update all the installed packages. | Yum upgrade command upgrades the installed packages more aggressively. |
It only updates the existing packages by replacing the old versions. | This command upgrades packages by removing the old ones. |
Sets the –obsolete flage=0. | Sets the –obsolete flage=1. |
Doesn’t change dependency. | Can alter dependency. |
Keep dependency and config files intact of the outdated packages. | Removes the outdated package including dependency and config files. |
How Does Yum Update Work?
Yum update is used by the Red-hat Linux distro to update package information and replace the backdated versions of the packages with the new version available in the repository. Let’s know what the yum update command does after executing in the red-hat terminal:
Steps to Follow >
➊ Open the Red-hat terminal.
➋ Write the following command to update the package version:
sudo yum update
- sudo: Provides administrative privileges.
- yum: A package manager, used to manage packages in Red-hat-based Linux.
- update: Updates packages to their recent version.
After typing the Red-hat password, press ENTER to initiate the installation and update to the newer version packages.
Write ‘y’ and press ENTER to complete the update operation.
How Does Yum Upgrade Work?
Yum upgrade also updates packages but it can remove the outdated package and install the new one. In order to know how to achieve that, follow the steps below:
Steps to Follow >
➊ Open the Red-hat terminal.
➋ Write this command to upgrade the package version using yum upgrade:
sudo yum upgrade
- upgrade: Upgrades installed packages by replacing or removing the old ones.
Type your Red-hat password then press ENTER to start upgrading.
Now, type ‘y’ to complete the upgrading process.
Is It Safe to Run “yum upgrade” Command in Linux?
To keep your system clean and up-to-date, yum upgrade is the best command to run in your Linux system. However, there are some conditions to keep in mind while upgrading packages. They are:
- Data Backup: It is a good practice to back up your necessary data before running the yum upgrade as this command has the potential to delete the packages that seem unnecessary to the yum.
- Regularly Checking Updates: You should check updates regularly to review what updates are available while packages are upgraded. Updating packages on a regular basis protects your computer from security threats and vulnerabilities.
- Checking Dependency Concerns: Dependency can be altered or removed by the yum upgrade command if any conflicts happen. So check dependency before upgrading packages. You can follow this article to learn how to check dependency using the Yum package manager.
- Network Connectivity: A stable network is required during a system upgrade. Otherwise, a partial upgrade can lead to your system being broken. So ensure better connectivity before upgrade operation.
- Restart if required: Some updates may require restraining the OS system, if prompted to reboot then follow the instructions consciously.
Comparative Analysis of Yum Update and Upgrade
In this section, I will tell you some pros and cons of yum update and upgrade commands to help you find your best command.
Commands | Pros | Cons |
---|---|---|
Yum Update |
|
|
Yum Upgrade |
|
|
If you want a complete cleanup of your Linux system and save disk space, go for the yum upgrade command. On the other hand, run the yum update command in your Linux terminal to minimize potential risks.
Conclusion
I hope this article helps you to know the differences between yum update and upgrade. You have also learned how to run these commands in the Red-hat terminal. I have described some precautions that you should take before performing a package upgrade. Keep your Linux system updated by following this article. Best wishes.
People Also Ask
Related Articles
- dnf Update Vs Upgrade [Which One Is Better]
- How to Upgrade With ‘sudo apt-get’ Command [2 cases]
- How to Use ‘sudo apt full-upgrade’ in Linux [A complete Guide]
- Apt-get Update Vs Upgrade [What’s the Difference]
<< Go Back to Upgrade Package in Linux | Package Management in Linux | Learn Linux Basics
FUNDAMENTALS A Complete Guide for Beginners
Thanks, well explained
Thanks for the feedback Mahmoud Saadi. Stay connected for more content like this.