YUM (Yellowdog Updater, Modified) is a package manager for RPM-based Linux distributions like CentOS, RHEL, and Fedora. It simplifies the process of installing, updating, and managing software packages.
yum [options] <subcommand> [arguments]
Subcommand | Description | Common Options/Arguments |
---|---|---|
install |
Installs one or more packages | <package_name> , --nogpgcheck |
update |
Updates packages | [<package_name>] , -y |
upgrade |
Updates packages and handles obsoletes | [<package_name>] |
remove |
Removes one or more packages | <package_name> |
list |
Lists packages | installed , available , updates , <package_name> |
info |
Displays package information | <package_name> |
search |
Searches packages by keyword | <keyword> |
provides |
Finds which package provides a file | <file_name> |
repolist |
Lists repositories | all , enabled , disabled |
clean |
Cleans cached data | all , packages , metadata |
groupinstall |
Installs a group of packages | "<group_name>" |
groupremove |
Removes a group of packages | "<group_name>" |
grouplist |
Lists available package groups | hidden , groups |
groupinfo |
Displays information about a package group | "<group_name>" |
history |
Displays transaction history | list , info , undo , redo , rollback |
check-update |
Checks for available package updates | None |
makecache |
Downloads and caches repository data | None |
downgrade |
Downgrades a package to an earlier version | <package_name> |
deplist |
Displays dependencies of a package | <package_name> |
reinstall |
Reinstalls a package | <package_name> |
distrosync |
Synchronizes installed packages to the latest versions | None |
To see the version of YUM installed:
yum --version
Lists all currently enabled repositories:
yum repolist
Lists all repositories configured on your system, including both enabled and disabled ones:
yum repolist all
You can enable a repository by:
-
Manually editing the repository file in
/etc/yum.repos.d/
and settingenabled=1
. -
Using the command:
yum config-manager --enable <repo-id>
Shows all packages (installed and available):
yum list
yum list installed
yum list available
yum list recent
Lists installed packages that are not available from any enabled repository (orphaned or manually installed packages):
yum list extras
Checks for available updates for installed packages without installing them:
yum check-update
Updates existing packages without changing or replacing any packages:
yum update
- Does not replace or remove obsolete packages.
Updates a specified package only:
yum update <package-name>
Performs all actions of yum update
and also handles obsolete packages by replacing them with their updated counterparts:
yum upgrade
yum upgrade <package-name>
Searches for packages related to a specified string in all enabled YUM repositories:
yum search <string>
Provides all information about a package:
yum info <package-name>
Installs one or more packages:
yum install <package-name>
-
Example:
yum install nmap
-
To install multiple packages matching a pattern:
yum install bash*
Uninstalls a package:
yum remove <package-name>
- Note: Do not use wildcards when removing packages, as it may remove necessary dependencies leading to system instability.
Searches for packages that provide a file or capability matching the specified keyword:
yum provides <string>
-
Example:
yum provides ifconfig
Reverts or downgrades an installed package to an earlier version:
yum downgrade <package-name>
- Automatically handles dependencies, ensuring required packages are also downgraded if necessary.
Reinstalls a package:
yum reinstall <package-name>
Shows dependencies of a package and providers of it:
yum deplist <package-name>
Clears the YUM cache:
yum clean all
-
Removes:
- Package Cache (
/var/cache/yum/
): Removes all cached.rpm
packages. - Metadata Cache (
/var/cache/yum/*
): Clears repository metadata to force re-download. - Headers and XML Data (
/var/lib/yum/
): Removes old repository data andrepomd.xml
files.
- Package Cache (
Rebuilds the YUM cache:
yum makecache
-
Cache location:
/var/cache/dnf
(depending on system configuration). -
If issues persist, manually remove files from the cache directory and regenerate the cache:
rm -rf /var/cache/dnf/* yum makecache
Displays the transaction history of YUM (installations, updates, removals):
yum history
Synchronizes installed packages to match the latest available versions in the repository, updating, downgrading, or reinstalling packages as needed:
yum distrosync
A group in YUM is a collection of related software packages bundled together for easier management.
Lists all package groups (installed and available):
yum grouplist
Installs a group of packages:
yum groupinstall "<group-name>"
-
Example:
yum groupinstall "Development Tools"
-
Important groups:
- Minimal Install
- Server with GUI
- Development Tools
- Security Tools
- System Tools
- GNOME Desktop Environment
Removes a group of packages:
yum groupremove "<group-name>"
Shows group info, including the packages it contains:
yum groupinfo "<group-name>"