YUM (Yellowdog Updater Modified) and DNF (Dandified YUM) are popular package management tools used primarily in Red Hat-based Linux distributions such as Red Hat Enterprise Linux (RHEL), CentOS, and Fedora. These package managers simplify software installation, upgrading, and removal by automating dependency resolution and handling software repositories.
Overview of YUM and DNF
YUM: The traditional package manager used in RHEL and CentOS prior to version 8. It automates package downloads, installations, and updates with dependency management.
DNF: Introduced as the next-generation replacement for YUM, beginning with Fedora 22 and RHEL 8. DNF provides improved performance, better dependency resolution, and a more consistent API.
Despite differences, YUM and DNF share a similar command structure, making the transition seamless for users.
Both YUM and DNF retrieve up-to-date package metadata from configured repositories before any installation or upgrade operation.
Command:
sudo yum check-updateor
sudo dnf check-updateThis fetches the latest package info but does not perform upgrades.
Installing New Software
To install a new package:
sudo yum install package_nameor
sudo dnf install package_nameExample:
sudo dnf install httpdinstalls the Apache HTTP server.
To install multiple packages at once:
sudo yum install package1 package2YUM/DNF resolves and installs dependencies automatically.
To upgrade all packages to the latest available versions:
sudo yum updateor
sudo dnf upgradeThis command downloads and installs package updates from repositories. Users are prompted to confirm before proceeding unless the -y flag is used:
sudo dnf upgrade -yRemoving Packages
To uninstall software:
sudo yum remove package_nameor
sudo dnf remove package_nameRemoves the specified package and optionally unused dependencies.
Searching and Listing Packages
Additional Useful Options
1. Clean Cache:
sudo yum clean all
sudo dnf clean allClears cached metadata and packages to free space and refresh repositories.
2. History Management: Use yum history or dnf history to view or undo previous transactions.
Transition from YUM to DNF
1. Fedora and RHEL have moved towards DNF for enhanced capabilities.
2. DNF is backward compatible with YUM commands, so most knowledge is transferable.
3. DNF offers improvements in memory usage and extensibility.