dnf vs apt - a coPilot perspective

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
3,272
Reaction score
3,027
Credits
29,138
Copilot
Sent by Copilot:
Sure, I can help clarify the differences between apt and dnf and which might be easier to use.

APT (Advanced Package Tool)
Used By: Debian-based distributions (e.g., Ubuntu).
Commands: apt, apt-get, apt-cache.
Functionality:
apt is a newer, user-friendly command that combines functionalities of apt-get and apt-cache.
apt-get is used for installing, upgrading, and removing packages.
apt-cache is used for searching and querying package information.
Ease of Use: Can be a bit confusing due to the need to switch between apt, apt-get, and apt-cache for different tasks.

DNF (Dandified YUM)
Used By: RPM-based distributions (e.g., Fedora, RHEL).
Commands: dnf.
Functionality:
dnf is a single command that handles all package management tasks, including installing, updating, and removing packages.
It automatically updates its package cache, so you don’t need a separate command for that.
Ease of Use: Generally considered more straightforward because it consolidates all package management tasks into one command2.

Comparison
User-Friendliness: dnf might be easier for new users because it uses a single command for all tasks, reducing the need to remember multiple commands.
Advanced Features: Both have advanced features, but dnf’s automatic cache updates and simpler syntax can make it more convenient for everyday use.
If you find switching between apt, apt-get, and apt-cache confusing, you might appreciate the simplicity of dnf. However, both tools are powerful and effective for managing packages on their respective distributions.
 


If you find switching between apt, apt-get, and apt-cache confusing, you might appreciate the simplicity of dnf. However, both tools are powerful and effective for managing packages on their respective distributions.
I guess the different commands can be confusing in the first instance, but simplicity does come at the cost of significantly reduced function and power. The apt suite of programs is quite extensive and provides for quite a lot more than the basic functions of installing, removing and fulfilling the dependency requirements of packages. To mention one example, the aptitude program, if asked, will provide reasons for dependency problems and propose resolutions for the user. Here's an incomplete list of the family:
apt
apt-cache
apt-cdrom
apt-config
apt-extracttemplates
apt-file
apt-forktracer
apt-ftparchive
apt-get
aptitude
apt-build
apt-cacher
apt-dater
apt-dater-host
apt-mirror
apt-show-source
apt-move
apt-offline
aptitude-changelog-parser
aptitude-create-state-bundle
aptitude-curses
aptitude-run-state-bundle
apt-key
apt-listbugs
apt-listchanges
apt-mark
apt-show-versions
apt-sortpkgs
apt-secure
apt_auth.conf
apt-preferences
apt-transport-http
apt-transport-https
apt-transport-mirror
 
Here’s a summary of dnf equivalents for various apt commands:

Basic Commands

  • apt: General package management.
    • dnf: General package management.

Package Information

  • apt-cache: Search and query package information.
    • dnf search: Search for packages.
    • dnf info: Show package information.

CD-ROM Management

  • apt-cdrom: Add CD-ROM as a package source.
    • dnf config-manager --add-repo: Add a repository, including from CD-ROM.

Configuration

  • apt-config: Query and set configuration options.
    • dnf config-manager: Manage configuration options.

Template Extraction

  • apt-extracttemplates: Extract templates from packages.
    • No direct equivalent in dnf.

File Search

  • apt-file: Search for files within packages.
    • dnf provides: Find which package provides a file.

Repository Management

  • apt-ftparchive: Create package repository metadata.
    • createrepo: Create metadata for a repository.

Package Installation and Removal

  • apt-get: Install, upgrade, and remove packages.
    • dnf install: Install packages.
    • dnf remove: Remove packages.
    • dnf upgrade: Upgrade packages.

Advanced Package Management

  • aptitude: Advanced package management interface.
    • No direct equivalent in dnf, but dnf itself covers many advanced features.

Build and Cache Management

  • apt-build: Build packages from source.
    • dnf builddep: Install dependencies for building packages.
  • apt-cacher: Cache packages for local network.
    • dnf-automatic: Automate package updates (not a direct cache equivalent).

Miscellaneous Tools

  • apt-key: Manage repository keys.
    • rpm --import: Import GPG keys.
  • apt-mark: Change package state.
    • dnf mark: Mark packages for specific actions.
  • apt-show-versions: Show package versions.
    • dnf list: List packages and their versions.

Transport Methods

  • apt-transport-http, apt-transport-https: HTTP/HTTPS transport methods.
    • dnf: Supports HTTP/HTTPS by default.

Preferences and Security

  • apt-preferences: Set package preferences.
    • dnf config-manager --setopt: Set configuration options.
  • apt-secure: Security-related options.
    • dnf: Includes security features by default.

Offline Management

  • apt-offline: Offline package management.
    • dnf download: Download packages for offline installation.
While dnf consolidates many functions into fewer commands, it covers most of the functionalities provided by apt and its related tools.

There are a few commands and features in dnf that don’t have direct equivalents in apt. Here are some notable ones:
  1. Group Management:
    • dnf group list: Lists available package groups.
    • dnf group install <group>: Installs all packages in a specified group.
    • dnf group remove <group>: Removes all packages in a specified group.
    • dnf group upgrade <group>: Upgrades all packages in a specified group.
  2. Module Management:
    • dnf module list: Lists available modules.
    • dnf module install <module>: Installs a specified module.
    • dnf module remove <module>: Removes a specified module.
    • dnf module enable <module>: Enables a specified module stream.
    • dnf module disable <module>: Disables a specified module stream.
  3. Automatic Updates:
    • dnf-automatic: A tool for automating package updates, which can be configured to run updates at specified intervals.
  4. History Management:
    • dnf history: Shows the history of transactions (installations, updates, removals).
    • dnf history undo <transaction-id>: Reverts a specific transaction.
    • dnf history redo <transaction-id>: Reapplies a specific transaction.
  5. Repository Management:
    • dnf config-manager --add-repo <url>: Adds a new repository.
    • dnf config-manager --set-enabled <repo>: Enables a repository.
    • dnf config-manager --set-disabled <repo>: Disables a repository.
  6. Download Packages:
    • dnf download <package>: Downloads a package without installing it.
These features make dnf quite powerful and flexible, especially for managing groups of packages and automating updates.

 
Last edited:
Here’s a summary of dnf equivalents for various apt commands:

That's good to know. I didn't doubt that dnf or other programs could accomplish the functions of apt and its suite of programs, rather my interest was piqued to extract all the apt family that lives on a machine here, most of which I have used at some point, but most of them infrequently. My experience with fedora seeped away in about 2018 so I'd leave the expositions on dnf to those with the relevant experience.

In my earlier days with Red Hat, there was only rpm available and it wasn't hard to fall into dependency hell. Modern users of linux have package managers that now routinely resolve dependencies so the comfort zone for managing one's system has become relatively luxurious. :)
 
Last edited:

Staff online


Top