yum Command in Linux

Learn via video courses
Topics Covered

Overview

The yum command in Linux is a powerful utility for package management in RPM (Red Hat Package Manager) based systems. It stands for 'Yellowdog Updater, Modified' and is an interactive, automated update program which can be used for maintaining systems using RPM. With the yum command in Linux, you can install, update, remove or search software packages on a system.

Syntax of yum Command in Linux

The basic syntax of the yum command in Linux is as follows:

Where:

  • options: These are optional and modify the behavior of the yum command.
  • command: This is what you want yum to do, such as install, update, or remove.
  • package: The name of the software package you want to install, update, or remove.

Options in yum Command in Linux

  1. -y: This option will make yum assume 'yes' as answer to all prompts and run non-interactively.

    For example -

    Output:

    The '-y' option allows the update to proceed without user interaction.

  2. list: Displays a list of all packages in the repositories.

    For example -

    Output:

    The 'list' option is used to display all available and installed packages.

  3. search: Searches for a specified package in the repositories.

    For example -

    Output:

    The 'search' command is used to find a specific package in the repository.

Example Usages

  • Installing a package:

    Output:

    Explanation: The 'install' command is used to install a new package.

  • Updating all packages:

    Output:

    Explanation: The 'update' command is used to update all packages installed on the system.

Tips

  • The 'yum history' command can be used to view the transaction history.

  • Using 'yum check-update' before 'yum update' can help you review what will be updated.

Advanced Use Cases of yum Command in Linux

  • Removing a package along with its dependencies:

    Output:

    Explanation: The 'autoremove' command is used to remove a package and its unused dependencies.

  • Installing a group of packages:

    Output:

    Explanation: The 'groupinstall' command is used to install a group of related packages.

  • Listing all enabled repositories:

    Output:

    Explanation: The 'repolist' command is used to display all repositories that yum can install software from.

Conclusion

  • The yum command in Linux is a versatile tool for managing packages on RPM-based Linux distributions.

  • It allows you to install, update, and remove packages along with their dependencies.

  • Advanced features include group installation and removal, and managing repositories.