Comparing the packaging tools in Ubuntu and Red Hat Enterprise Linux

Amit PaunikarAmit 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.

OperationUbuntuRHEL
Download package information from all configured sourcesapt updateDone automatically
Install a packageapt install <package_name>dnf install <package_name>
Install multiple packagesapt install <package1_name> <package2_name>dnf install <package1_name> <package2_name>
Install a package with a particular versionapt install <package_name>=<version>
Upgrade a packageapt upgrade <package_name>dnf upgrade <package_name>
Install available upgrades of all packages currently installed on the systemapt 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 packageapt remove <package_name> (but does not remove configuration files)dnf remove <package_name>
Remove multiple packagesapt 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 neededautoremovednf remove <package_name> removes unused dependencies after package is uninstalled
Remove package as well as configuration filesapt purge <package_name>dnf remove <package_name> removes everything
Search for a particular available packagesapt search <package_name_regex>dnf search <package_name_regex>
List all installed packagesapt list --installed'dnf list --installed`
List all packages available to installapt 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 availableapt list --upgradeablednf 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

Amit Paunikar
Amit Paunikar