Comparing the packaging tools in Ubuntu and Red Hat Enterprise Linux
Amit Paunikar
2 min read
The Linux distributions of Ubuntu and Red Hat Enterprise Linux (RHEL) use different tools for packaging. Ubuntu/Debian distributions use apt (earlier apt-get and dpkg), whereas RHEL/CentOS/Fedora distributions uses dnf (earlier yum and rpm). Though the commands and their options are mostly similar, we can see some minor differences.
The following lists only some basic operations, we will look at some more commands in detail in future articles.
Operation | Ubuntu | RHEL |
Download package information from all configured sources | apt update | Done automatically |
Install a package | apt install <package_name> | dnf install <package_name> |
Install multiple packages | apt install <package1_name> <package2_name> | dnf install <package1_name> <package2_name> |
Install a package with a particular version | apt install <package_name>=<version> | |
Upgrade a package | apt upgrade <package_name> | dnf upgrade <package_name> |
Install available upgrades of all packages currently installed on the system | apt upgrade (if an upgrade for a package requires the remove of an installed package the upgrade for this package isn't performed) OR apt full-upgrade (will remove currently installed packages if this is needed to upgrade the system as a whole) | dnf upgrade |
Remove a package | apt remove <package_name> (but does not remove configuration files) | dnf remove <package_name> |
Remove multiple packages | apt remove <package1_name> <package2_name> | dnf remove <package1_name> <package2_name> |
Remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed | autoremove | dnf remove <package_name> removes unused dependencies after package is uninstalled |
Remove package as well as configuration files | apt purge <package_name> | dnf remove <package_name> removes everything |
Search for a particular available packages | apt search <package_name_regex> | dnf search <package_name_regex> |
List all installed packages | apt list --installed | 'dnf list --installed` |
List all packages available to install | apt list --all-versions | 'dnf list --available' |
Show information about the given package(s) including its dependencies, installation and download size, etc. | apt show <package_name> | dnf info <package_name> |
List all packages for which upgrades are available | apt list --upgradeable | dnf list --upgrades |
Acronyms-
- apt: Advanced Package Tool
- rpm: RedHat Package Manager
- yum: Yellowdog Updater, Modified
- dnf: Dandified Yum
0
Subscribe to my newsletter
Read articles from Amit Paunikar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by