Open In App

YUM Commands for Linux Package Management

Last Updated : 10 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

If you are a Linux user or system administrator, chances are you’ve come across YUM (Yellowdog Updater, Modified) at some point in your journey. YUM is a powerful package management tool that simplifies the process of installing, updating, and managing software on Red Hat-based Linux distributions like CentOS and Fedora. In this article, we will delve into the most common YUM commands, providing detailed explanations and real-world examples to help you harness its full potential.

Basic Syntax of `yum` command in Linux

Before we dive into the most common YUM commands, let’s start with the basic syntax:

yum [options] [command] [package(s)]

Here,

  • [options] are optional flags that modify the behaviour of the command.
  • [command] is the YUM operation you want to perform (e.g., install, update, remove).
  • [package(s)] specify the package(s) you want to work with.

Commonly used YUM Options in Linux

These options cover a wide range of package management tasks, from installation and updates to package removal and repository management. You can combine them with other YUM commands to perform specific operations efficiently on your Linux system.

Options

Description

install package

Install a package

update

Update all packages

remove package

Remove a package

update package

Update a specific package

Search keyword

Search for packages by keyword

list installed

List all installed packages

info package

Display detailed information about a package

clean all

Clean the YUM cache

check-update

Check for updates without installing them

groupinstall group

Install a group of packages

autoremove

Remove unused dependencies

check

Check the local database for problems

provides file

Find which package provides a specific file

whatprovides keyword

Find packages that provide a keyword

repolist

List enabled and disabled repositories

makecache

Generate metadata cache

updateinfo

View and manage package update information

Common YUM Commands:

1. Installing Packages:

This command is used to install packages on your system using YUM. Replace package-name with the name of the package you want to install. YUM will automatically handle dependencies and download the necessary files from repositories.

sudo yum install package-name






Example:

sudo yum install nginx





Installing Packages

Installing Packages

2. Updating Packages:

Keeping your system up to date is important for security and performance. Running this command will check for updates for all installed packages and install any available updates.

sudo yum update




Updating Packages

Updating Packages

3. Removing Packages:

Use this command to remove a package from your system. Replace `package-name` with the name of the package you want to uninstall. YUM will also remove any dependencies that are no longer needed.

sudo yum remove package-name






Example:

sudo yum remove nginx




Removing Packages

Removing Packages

4. Searching for Packages:

This command allows you to search for packages by providing a keyword. YUM will display a list of packages that match the keyword, making it easier to find the package you need.

yum search keyword






Example:

yum search python




Searching for Packages

Searching for Packages

5. Listing Installed Packages:

Running this command will provide you with a list of all the packages that are currently installed on your system. It’s useful for checking what software is already present.

yum list installed




Listing Installed Packages

Listing Installed Packages

6. Display Package Information:

Use this command to get detailed information about a specific package, including its description, version, dependencies, and more.

yum info package-name






Example:

yum info python




Display Package Information

Display Package Information

7. Cleaning YUM Cache:

Over time, YUM accumulates cache data that can take up disk space. Running this command clears the YUM cache, helping to free up space on your system.

sudo yum clean all




Cleaning YUM Cache

Cleaning YUM Cache

Advanced YUM Commands:

8. Enabling and Disabling Repositories:

YUM uses repositories to fetch packages. You can enable or disable specific repositories as needed, allowing you to control which packages are available for installation or updates.

sudo yum-config-manager --enable repository






sudo yum-config-manager --disable repository






9. Checking for Updates Without Installing:

This command checks for available package updates without actually installing them. It’s useful for previewing what updates are available before deciding to install them.

sudo yum check-update




Checking for Updates Without Installing

Checking for Updates Without Installing

10. Installing Groups of Packages:

YUM allows you to install predefined groups of packages, such as development tools or web servers, by specifying the group name. This can simplify the installation of multiple related packages.

sudo yum groupinstall group-name






Example:

sudo yum groupinstall "Development Tools"






11. Removing Unused Dependencies:

YUM can remove dependencies that are no longer needed by any installed package. This helps to keep your system clean and efficient by removing unnecessary files.

sudo yum autoremove




Removing Unused Dependencies

Removing Unused Dependencies

12. Verbose Output:

If you want more detailed information during YUM operations, you can use the `-v` (verbose) option. It will provide additional output about the installation process, which can be helpful for debugging or monitoring progress.

sudo yum -v install package-name






Conclusion:

YUM is a versatile and indispensable tool for managing software packages on Red Hat-based Linux distributions. In this guide, we’ve covered the most common YUM commands, from installing and updating packages to searching for software and managing repositories. Armed with this knowledge and the provided examples, you can confidently navigate the world of package management in the Linux ecosystem, making your system administration tasks more efficient and productive.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads