YUM (Yellowdog Updater Modified) and APT (Advanced Packaging Tool) are commonly used command line package managers on Linux systems. YUM is used to manage RPM packages, mainly on Red Hat based distributions like RHEL, CentOS, Rocky Linux etc. APT is used to manage DEB packages on Debian, Ubuntu, Linux Mint etc.
Both YUM and APT provide simple ways to install, update, remove and manage software packages from online repositories. However, there are some key differences between these two tools in terms of how they function, configurations and the Linux distributions they support.
How YUM and APT Work
YUM and APT simplify package management using repositories, dependencies and a database.
Repositories
A repository is a collection of software packages stored at a remote location. Both YUM and APT tools rely on repositories to download and install packages from.
Popular YUM repositories include:
- BaseOS – contains Red Hat packages for CentOS/RHEL systems
- EPEL – Extra Packages for Enterprise Linux
- RPM Fusion – Additional packages including multimedia codecs
Some common APT repositories are:
- Main – Canonical-supported open-source software
- Universe – Community maintained software
- Multiverse – Proprietary software and drivers
Additional repositories can be added to extend available software.
Dependencies
Most software has dependencies – other packages needed to function properly. When installing a package, YUM and APT will automatically download and install the required dependencies.
For example, installing the VLC media player pulls in dependency packages like FFmpeg libraries. This simplifies the installation process.
Database
Both YUM and APT utilize a database to keep track of installed packages, available updates, dependencies etc. Having this metadata helps manage software and system updates efficiently.
- YUM uses an sqlite database located at /var/lib/rpm/
- APT stores package info in /var/lib/dpkg
The database ensures system consistency and allows changes to be rolled back if needed.
Key Differences Between YUM and APT
While YUM and APT provide similar package management capabilities, there are some notable differences between the two:
Package Format
The most fundamental difference is the package format used:
-
YUM uses .rpm (RPM Package Manager) packages – The RPM file format is used by Red Hat, CentOS, Fedora and other similar distributions.
-
APT uses .deb (Debian) packages – The DEB format is used in Debian, Ubuntu, Linux Mint and related distros.
This means YUM can only install RPM files and APT can only use DEB packages by default.
Linux Distributions Supported
As a result of the package format difference, YUM and APT are designed for different distributions:
-
YUM is the package manager for RHEL, CentOS, Oracle Linux, Scientific Linux, etc. These all use .rpm packages.
-
APT works with Debian, Ubuntu, Linux Mint and other .deb based distributions.
Some distributions support both formats, allowing either tool to be used. But most will favor the native package type for that OS.
Configuration Format
The configuration files used by the tools also differ:
-
YUM configuration is stored in /etc/yum.conf. This INI-style file has a
[main]section plus per-repository sections. -
APT configuration is split across several files under /etc/apt including apt.conf, preferences, sources.list and more. These have a simpler format than yum.conf.
So APT opts for multiple config files while YUM consolidates settings into one main file.
Command Options
While YUM and APT share commands for installing, removing, updating and querying packages, some of their options differ:
Common YUM commands:
yum install <package> - Install a package
yum remove <package> - Uninstall a package
yum update - Update all packages
yum search <keyword> - Search package names & descriptions
yum info <package> - Show package information
Common APT commands:
apt install <package> - Install a package
apt remove <package> - Uninstall a package
apt update - Update repo metadata
apt upgrade - Install available package upgrades
apt search <keyword> - Search package names & descriptions
apt show <package> - Display package details
As can be seen, both provide similar functionality but with slightly different command options. YUM commands tend to be more noun-focused, while APT commands use more verbs.
Frequency of Updates
Another subtle difference is that the APT tool will retrieve updates from repositories more frequently than YUM.
For example, running apt update fetches the latest package metadata from all configured sources. But yum update will only check occasionally or when you specifically run yum check-update.
As a result, Debian/Ubuntu systems tend to show available updates more often compared to an equivalent CentOS/RHEL box. Whether this is an advantage or not depends on your preferences.
Package Signing
YUM has built-in GPG key checking to verify the authenticity of packages from repositories. This protects against tampered or malicious code. Signed packages have enhanced security by default with YUM.
In contrast, APT does not automatically check signatures. You need to manually enable it by installing debian-archive-keyring and setting up apt preferences. So APT offers more flexibility, but YUM provides more security out of the box.
Rollback Capabilities
YUM includes better rollback capabilities in case a package update breaks something. It can automatically reinstall the previous version.
APT can also undo changes by marking a package "on-hold". But the process is not as straightforward compared to yum history undo.
Graphical Frontends
Both YUM and APT can be managed from the command line interface (CLI). But there are also some graphical frontends available:
- Popular YUM frontends include Yumex and PackageKit.
- Synaptic and Apper are examples of APT graphical interfaces.
So administrators and users can manage packages graphically if desired, instead of the CLI.
When to Use YUM vs APT
As a review, here are some general guidelines on when to use YUM compared to APT:
-
Use YUM for RPM-based distributions – YUM should be used on Red Hat Enterprise Linux, CentOS, Rocky Linux, AlmaLinux, Oracle Linux, etc.
-
Use APT for DEB-based distributions – APT is designed for Debian, Ubuntu, Linux Mint and other distributions using DEB packages.
-
Some systems support both – Some distributions like openSUSE, Gentoo, Arch Linux support both .rpm and .deb packages. So you can choose either YUM or APT tools.
-
Stick to native format when possible – When a distro supports both, it‘s generally best to use the default package type for that OS (RPM on RHEL, DEB on Ubuntu).
So in summary, the Linux distribution you are running largely determines whether YUM or APT is the best choice for package management.
Conclusion
YUM and APT provide very similar capabilities for managing software packages on Linux. Both connect to remote repositories, automatically handle dependencies, maintain package databases and simplify install/remove of programs.
However, under the hood they use different packaging formats (.rpm vs .deb), configuration files, commands and more.
As a system administrator, it is valuable to understand both tools. But when choosing a package manager, start by identifying the distribution you are running. RPM-based Operating Systems like CentOS and RHEL should use YUM. Debian/Ubuntu flavors typically utilize APT.
Learning when to leverage YUM vs APT can simplify Linux package management and avoid frustrations down the road.


