yum

package managementLinux/Unix
The yum command is one of the most frequently used commands in Linux/Unix-like operating systems. yum Package manager for RPM-based Linux distributions

Quick Reference

Command Name:

yum

Category:

package management

Platform:

Linux/Unix

Basic Usage:

yum [options] [arguments]

Common Use Cases

    Syntax

    yum [options] command [package...]

    Options

    General Options

    Option Description
    -h, --help Display help information and exit
    -y, --assumeyes Automatically answer yes to all questions
    -q, --quiet Run with minimal output
    -v, --verbose Run with verbose output
    --version Show the version of yum and exit
    -C, --cacheonly Run entirely from system cache, don't update cache
    -c [config file] Use alternative config file instead of /etc/yum.conf
    --disablerepo=[repo] Disable specified repository
    --enablerepo=[repo] Enable specified repository
    --exclude=[package] Exclude specified package from updates or installs
    --installroot=[path] Set an alternative installation root
    --nogpgcheck Disable GPG signature checking

    Common Commands

    Command Description
    install Install specified package(s)
    update Update specified package(s) or all packages
    remove or erase Remove specified package(s)
    search Search package names and descriptions for specified string
    info Display information about a package or packages
    list List packages based on package names
    provides or whatprovides Find packages that provide the specified capability
    clean Clean the yum cache
    groupinstall Install the packages in the specified group
    groupupdate Update packages in the specified group
    groupremove Remove packages in the specified group
    grouplist List available package groups
    repolist List enabled repositories
    history View or use yum transaction history
    check-update Check for available updates but don't install
    makecache Download and make usable all repository metadata
    reinstall Reinstall a package
    downgrade Downgrade a package to an earlier version
    localinstall Install a local RPM package
    deplist List dependencies of a package

    Examples

    How to Use These Examples

    The examples below show common ways to use the yum command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    # Basic Examples Basic
    # Install a package yum install nginx
    # Remove a package yum remove nginx
    # Update a specific package yum update httpd
    # Update all packages yum update
    # Search for a package yum search mysql
    # Advanced Examples Advanced # Install multiple packages yum install httpd php mysql-server # Install a specific version of a package yum install httpd-2.4.6 # Install a package from a specific repository yum --enablerepo=epel install htop # Install a local RPM package, resolving dependencies yum localinstall ./package.rpm # Downgrade a package to an earlier version yum downgrade httpd # List all available packages yum list available # List all installed packages yum list installed # List all available package groups yum grouplist # Install a package group yum groupinstall "Development Tools" # Show information about a package yum info httpd # List all dependencies of a package yum deplist httpd # List all packages that depend on a specific package yum --whatdepends-on httpd # Check for and install updates with one command yum check-update && yum update -y # Clean all caches yum clean all

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The `yum` (Yellowdog Updater, Modified) command is a package management utility for RPM-based Linux distributions, including Red Hat Enterprise Linux (RHEL), CentOS, and Fedora (up to Fedora 21). It simplifies the process of installing, updating, removing, and managing software packages on these systems. **Core Functionality:** 1. **Package Management**: `yum` handles the installation, updating, and removal of software packages, automatically resolving dependencies to ensure that all required components are properly installed. 2. **Repository Management**: It works with repositories (collections of packages) that can be local or remote, allowing administrators to control which sources are used for software packages. 3. **Package Queries**: `yum` provides powerful querying capabilities to search for packages, display package information, and determine which packages provide specific files or features. 4. **Transaction History**: The tool maintains a history of transactions, enabling administrators to review past actions and even undo or redo them if necessary. **Key Features:** 1. **Dependency Resolution**: One of `yum`'s most important features is its ability to automatically resolve dependencies, ensuring that all required packages are installed along with the requested software. 2. **Group Management**: Packages can be organized into logical groups (such as "Development Tools" or "Web Server"), allowing for easier installation of related packages. 3. **Plugin Architecture**: `yum` supports plugins that extend its functionality, such as automatic updates (`yum-cron`), download-only options (`downloadonly`), and priority settings (`priorities`). 4. **Repository Prioritization**: Administrators can assign priorities to different repositories, controlling which sources are preferred when multiple repositories provide the same package. 5. **Delta RPMs**: When enabled, `yum` can download only the differences between the installed and updated versions of packages, saving bandwidth and time. 6. **Package Verification**: `yum` can verify the integrity and authenticity of packages using GPG signatures, helping to ensure that only trusted software is installed. **Configuration:** 1. **Main Configuration**: The primary configuration file is `/etc/yum.conf`, which contains global settings for `yum`. 2. **Repository Definitions**: Repository definitions are typically stored in files within the `/etc/yum.repos.d/` directory, with each file defining one or more repositories. 3. **Variables**: `yum` supports variables such as `$releasever` and `$basearch` that dynamically adjust repository URLs based on the system's release version and architecture. 4. **Plugins Configuration**: Plugins may have their own configuration files, usually located in `/etc/yum/pluginconf.d/`. **Common Usage Scenarios:** 1. **System Updates**: Regular system maintenance typically involves using `yum update` to keep all installed packages up to date with the latest security patches and bug fixes. 2. **Software Installation**: `yum install` is used to add new software to the system, with `yum` handling all the necessary dependencies. 3. **Package Queries**: System administrators often use `yum`'s search, info, and provides commands to locate packages and determine which packages contain specific files or features. 4. **Troubleshooting**: Commands like `yum history`, `yum deplist`, and `yum verify` are valuable for diagnosing and resolving package-related issues. 5. **System Provisioning**: In automated deployment scenarios, `yum` commands are often included in scripts or configuration management tools to ensure consistent software installation across multiple systems. **Advanced Features:** 1. **Transaction Management**: `yum` operations are performed as transactions, ensuring that package changes are applied atomically. If an error occurs, the transaction can be rolled back to prevent partial updates. 2. **Protected Packages**: Critical system packages can be protected from accidental removal using the `installonlypkgs` and `protect` settings. 3. **Multiple Package Repositories**: `yum` can work with multiple repositories simultaneously, including official distribution repositories, third-party repositories, and private internal repositories. 4. **Version Locking**: The `versionlock` plugin allows administrators to lock specific packages to particular versions, preventing them from being upgraded. 5. **Parallel Downloads**: `yum` can download multiple packages in parallel, improving performance on systems with good network connectivity. **Limitations and Considerations:** 1. **Performance**: `yum` can be slower than some other package managers, particularly when processing metadata for large repositories. 2. **Memory Usage**: Processing large repositories can require significant memory, which may be a constraint on systems with limited resources. 3. **Network Dependency**: By default, `yum` requires network access to repositories unless a local mirror or the `--cacheonly` option is used. 4. **Root Privileges**: Most `yum` operations require root privileges, though certain query operations can be performed by regular users. **Historical Context and Future:** Yum was developed as an improvement over the earlier `up2date` package manager used in Red Hat Linux. Its name stands for "Yellowdog Updater, Modified," as it was based on the YUP (Yellowdog Updater) tool developed for Yellow Dog Linux. In newer versions of Fedora (Fedora 22 and later), RHEL 8, and CentOS 8, `yum` has been replaced by `dnf` (Dandified YUM), which maintains compatibility with `yum` commands while addressing some of its limitations. In these systems, the `yum` command is often actually a compatibility layer over `dnf`. **Related Tools:** 1. **rpm**: The lower-level package manager that `yum` is built upon. `rpm` handles individual package operations but doesn't resolve dependencies automatically. 2. **dnf**: The successor to `yum`, offering improved performance, memory usage, and dependency resolution. 3. **createrepo**: A tool for creating `yum` repositories from collections of RPM packages. 4. **repoquery**: A powerful query tool for `yum` repositories (now integrated into `dnf` as `dnf repoquery`). 5. **subscription-manager**: In Red Hat systems, this tool manages subscriptions and entitlements that control access to repositories. Despite being superseded by `dnf` in newer distributions, `yum` remains an essential tool for managing software on many existing RPM-based Linux systems, particularly in enterprise environments where older, stable distributions are commonly used.

    Related Commands

    These commands are frequently used alongside yum or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the yum command works in different scenarios.

    $ yum
    View All Commands