Yum is a command-line package manager for RPM-based Linux systems, such as Red Hat Enterprise Linux, CentOS, Fedora, and Oracle Linux. It stands for "Yellowdog Updater, Modified" and was originally developed by Yellowdog Linux as a way to easily manage packages on their distribution.
Yum makes it easy to search for, install, remove, and update packages and dependencies, as well as handle any conflicts that may arise. It uses repositories, which are online collections of packages that can be installed on your system. These repositories contain metadata about the packages, such as version numbers and dependencies, which yum uses to resolve dependencies and ensure that the correct versions of packages are installed. Unlike it’s Debian cousin, which uses various commands for package management, yum can perform all package operations by itself.
Yum can also be used to manage system updates, including security updates and bug fixes. By regularly running yum update, you can ensure that your system is up-to-date and secure.
Useful flags
Assuming yes for all prompts
Assuming no for all prompts
Disabling GPG verification
Skipping broken packages
Skips packages that whose dependencies can’t be resolved.
Enabling/Disabling repository for single execution
You can dynamically enable or disable a repository for a single execution.
Quiet mode
Suppresses output except for errors and warnings.
Changelog
Display the changelog of a package
Package Management
Installing an RPM package
Installing an RPM package from remote repositories
Installing a local RPM package
Installing a specific version of a package
Removing an RPM package and dependencies
Removes a package and any package it depends on (provided nothing else depends on it).
Note: this will only remove the binaries and libraries, any configuration files will stay intact.
Downgrading a package
This will install the package’s previous version.
Viewing a package’s dependencies
Listing packages
The yum list
command can take different arguments:
Listing all available packages from repositories
Listing installed packages
Listing installed and available packages
Listing all packages (installed or available) that match a given [package-name], can be a glob
Searching for package
This searches for [package-name] across all repositories, also looking inside package descriptions.
Upgrading all system packages
This command installs all of the latest versions of each package installed on the system and is, generally, not recommended to be run on production systems.
Reinstalling a single package
Sometimes, it’s necessary to force reinstallation of a package.
Viewing info for a package
Finding which RPM package installs a given file
This command is very handy when it’s not obvious which package needs to be installed to use it.
yum provides
can also take a glob:
Listing all dependencies for a given package
Package groups
yum-groups-manager is a command-line tool used to manage package groups in yum, a package manager for RPM-based Linux systems. yum-groups-manager allows you to create, edit, and delete package groups, as well as modify the packages and dependencies included in each group. You can also use it to generate a new yum repository configuration file containing only the package groups you specify, which can be useful for creating custom repositories.
Package groups are collections of packages that can be installed together, typically for a specific purpose, such as a desktop environment or web server.
Listing all groups
Installing all packages for a group
Removing all packages for a group
Repository Management
Listing all repositories
Listing all packages for a given [repository]
Installing all packages from given [repository]
Removing all packages from a given [repository]
Updating local metadata cache
This is run automatically by yum as needed, but can be refreshed manually with yum makecache
When this command is run, all available packages are fetched and re-indexed from the repositories yum knows about.
yum-utils and yumdownloader
yum-utils is a collection of utilities and plugins for yum, a package manager for RPM-based Linux systems. These utilities and plugins are designed to extend the functionality of yum and provide additional tools for managing packages and repositories.
yumdownloader is a command-line utility that comes with the yum-utils package in RPM-based Linux systems. It allows you to download packages from yum repositories without installing them, which can be useful for creating local repositories or installing packages on systems without internet access.
Downloading RPMs
Downloading RPM from remote repositories
Downloading Source RPMs
Downloading all dependencies for an RPM
Filtering by architecture
More
yum-utils adds other useful commands to yum
that are too specific to cover here but are still worth looking over at the YumUtils website.
You can find a complete list of yum commands here.
DNF
DNF is the next generation of package management for redhat based operating systems.
DNF, or Dandified Yum, is a modern package management tool that has been developed as a successor to the popular Yum package manager for RPM-based Linux distributions. DNF is designed to provide better performance, improved dependency resolution, and a more user-friendly command-line interface compared to Yum.
Some of the key features and benefits of DNF include:
-
Faster and more efficient package management: DNF is faster than Yum and uses less memory, making it more efficient for large-scale package management tasks.
-
Improved dependency resolution: DNF uses a more advanced algorithm for dependency resolution, which can help prevent conflicts and ensure that packages are installed and updated correctly.
-
User-friendly command-line interface: DNF has a more intuitive and user-friendly command-line interface, with features such as tab completion and easy-to-read output.
-
Built-in plugins: DNF comes with a number of built-in plugins for tasks such as managing repositories, cleaning up old packages, and downloading packages without installing them.
-
Support for modular content: DNF supports modular content, which allows packages to be grouped together in modules with different lifecycles and update policies.
Getting more familiar with your package manager’s tools can help you be more productive when finding, installing, and querying packages. There is no need to memorize or learn the commands, just use this cheat sheet!