Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Advantages of Yum
3.
Yum vs Other Package Managers
4.
Installing Yum in Linux
5.
Understanding Yum Repository
6.
Yum Commands
6.1.
Install a Package
6.2.
Search for a Package
6.3.
Package Information
6.4.
Update a Package
6.5.
Remove a Package
6.6.
Update System
6.7.
Check for Security Updates
7.
Yum Plugins
7.1.
Level Up with Yum Plugins for System Management
8.
Yum Version Locking
9.
Yum in Linux and Security
10.
Troubleshooting Yum
11.
Frequently Asked Questions
11.1.
How do I install a package using Yum in Linux?
11.2.
Can I search for a specific package using Yum in Linux?
11.3.
How do I lock a package to a specific version using Yum in Linux?
12.
Conclusion
Last Updated: Mar 27, 2024
Easy

YUM in Linux

Author Sanchit Kumar
0 upvote
Create a resume that lands you SDE interviews at MAANG
Speaker
Anubhav Sinha
SDE-2 @
12 Jun, 2024 @ 01:30 PM

Introduction

Yum, short for "Yellowdog Updater, Modified", is an excellent tool primarily used in RPM-based Linux distributions like Red Hat Enterprise Linux, CentOS, and Fedora. It simplifies installing, updating, and removing software packages, making it necessary for system administrators and Linux users.

Yum in Linux

This article will explore the different things related to Yum in Linux and how it simplifies package management. Let us get started with the advantages of Yum in Linux first.

Advantages of Yum

  1. Easy Package Management and Dependency Resolution: It handles dependencies and updates like a pro, so you can install, update, and remove software with just one simple command. No more headaches over library clashes or conflicts!
     
  2. Extensive Package Repository: With Yum, you can access vast repositories. You'll find tons of software packages, from official distributions to community-contributed goodies, ready to explore.
     
  3. Plugin Support: Yum is no ordinary package manager. It's all about that extra flair! Its plugin support lets you tailor the package management experience to your liking. You can customise Yum to suit your needs, making it even more powerful.
     
  4. Updates and Security: Yum is always looking for updates and security patches so your system stays up-to-date and secure without any fuss.
     
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Yum vs Other Package Managers

Yum isn't the only player in town! Other popular package managers like "apt" (found in Debian-based distributions) and "zypper" (in SUSE Linux) have their charm. But for RPM-based systems like RHEL, CentOS, and Fedora, Yum is a natural choice. Its seamless integration with RPM format and fantastic dependency resolution gives it the edge.

Installing Yum in Linux

Before diving in, let's check if Yum is already on board. Open a terminal and type 'yum --version'. If it's installed, you'll see its version info; otherwise, you'll get a message saying Yum is not found.

Installing Yum in Linux

 

No worries if you need to install Yum; it's easy! The command may vary depending on your Linux distribution.

  • For CentOS/RHEL 8 and Fedora: 'sudo dnf install yum'
  • For CentOS/RHEL 7 and earlier: 'sudo yum install yum'
  • For Oracle Linux: 'sudo yum install yum-utils'


Once you've installed it, just double-check by running 'yum --version'.

yum version

If you see that version info on the screen, congrats, you've got Yum!

Understanding Yum Repository

Alright, let's dive into the world of Yum repositories! These storage locations hold RPM package files and metadata for Yum to access during installations, updates, or removals. They have both official distributions and third-party.

Setting up a repository

Go to the '/etc/yum.repos.d/' directory, create a new .repo file (let's call it "custom.repo"), and add the repository details.

Here's a trick you can enable or disable repositories to control which ones Yum uses to search for packages. Use the 'sudo yum config-manager' command with the '--enable' or '--disable' flag followed by the repository name.

Yum Commands

Now that you're all set up Let's learn about Yum commands depending on what they do.

The general syntax of the YUM command is:

yum [options] <command> [<args>...]

Install a Package

Use the following command syntax to install a package.

sudo yum install <pckg-name>
Install a Package

Search for a Package

Use the following command syntax to find a specific package.

sudo yum search <search_keyword>
Search for a Package

Package Information

Use the following command syntax to retrieve detailed information about a package.

sudo yum info <pckg-name>
Package Information

Update a Package

Use the following command syntax to obtain a package's latest features and bug fixes.

sudo yum update <pckg-name>
Update a Package

Remove a Package

Use the following command syntax to uninstall a software package and its associated files.

sudo yum remove <pckg-name>
Remove a Package

Update System

Use the following command to update everything, including the OS.

sudo yum update
Update System

Check for Security Updates

Use the following command to see a list of packages with available security updates.

sudo yum list-security
Check for Security Updates

Yum Plugins

Yum plugins extend Yum's capabilities, offering awesome features like faster downloads, version locking, and more.
 

Now, let us see some plugins.

  • fastestmirror: Selects the speediest mirror for downloads, making updates lightning fast.
     
  • priorities: Assigns priority to repositories so Yum knows which ones to go to first during installations and updates.
     
  • versionlock: Locks specific packages to a particular version—perfect for maintaining a stable system.
     
  • downloadonly: It lets you download RPM packages without installing them, which is great for creating offline repositories.
     

Level Up with Yum Plugins for System Management

Yum's got some cool plugins for system management. First up, yum-cron gets automatic updates for your system! Install it with 'sudo yum install yum-cron', start and enable the service, and you're ready.

And if you want additional Yum utilities, yum-utils is the way to go! From managing configurations and repositories, cleaning up the cache, and installing debug information.

Yum Version Locking

Version locking is like saying, "Hey, Yum, I love this package as it is—don't update it!" It's useful when you want to maintain a specific package version for compatibility or stability reasons.

To lock a package version, just tell Yum, 'sudo yum versionlock package-name'. And if you ever want to remove a package from the version lock list, no worries, use 'sudo yum versionlock delete package-name'.

Yum in Linux and Security

Yum is security-conscious too! It can prioritise security updates over others. With the yum-cron package, you can even set up automatic security updates keeping your system safer without any hassle.

And don't worry about installing compromised packages. Yum checks package authenticity using GPG keys, ensuring everything's legit before it's on your system.

Troubleshooting Yum

No tool is perfect, but Yum's close! Sometimes, you might run into common Yum issues like repository errors, network connectivity problems, or dependency conflicts.

To tackle this, you can try a few tricks.

  • Check your network connectivity first and ensure your system can reach the Yum repositories.
     
  • Clean up the Yum cache if things are off. Use 'sudo yum clean all' to freshen things up.
     
  • If a particular repository seems problematic, disable it temporarily with 'sudo yum config-manager --disable repository-name'.
     
  • And if things still seem wrong, look at the Yum transaction log, found at '/var/log/yum.log'. It might have some clues to help you out.
     

Frequently Asked Questions

How do I install a package using Yum in Linux?

To install a package with Yum, open a terminal and use the command: sudo yum install <package-name>. For instance, to install "git", you'd run sudo yum install git. Yum will handle all the dependencies, making the installation process hassle-free.

Can I search for a specific package using Yum in Linux?

Yes, Yum provides a convenient way to search for packages. To find a specific package, open a terminal and type: sudo yum search <search_keyword>. For example, if you're looking for the package "python", use sudo yum search python. Yum will display a list of packages matching your search term.

How do I lock a package to a specific version using Yum in Linux?

You can lock a package to a specific version with Yum using: sudo yum versionlock <package-name>. To remove a package from the version lock list, use: sudo yum versionlock delete <package-name>.

Conclusion

This article explored Yum in Linux, a powerful package manager for RPM-based systems like CentOS and Fedora. We learnt about its easy package management, repositories, plugin support, version locking, security Features of linux operating system, etc. We discussed Yum's commands and troubleshooting tips also. Alright! So now that you have learnt about Yum in Linux, you can also refer to other similar articles.

You may refer to our Guided Path on Code Studios for enhancing your skill set on DSACompetitive ProgrammingSystem Design, etc. Check out essential interview questions, practice our available mock tests, look at the interview bundle for interview preparations, and so much more!

Happy Learning, Ninja!

Previous article
How to Boot Linux from USB?
Next article
How to Change Username in Linux?
Live masterclass