This article covers DNF5, introduced in Fedora Linux 41 as the new standard for package management. We’ll explore the dnf5 install
command with practical examples, ensuring best practices for efficient package management.
Fedora Linux 41 is the first release to adopt DNF5, providing a faster, more efficient package management experience. DNF5 brings several improvements:
- Standalone Package Manager: No dependency on Python for core functionality.
- Reduced Install Size: A leaner, more lightweight tool.
- Enhanced Speed: Significantly faster performance in various use cases.
- Streamlined Tools: Fewer software management tools, simplifying the ecosystem.
- Optimized Metadata: More efficient handling of repository metadata.
- Unified Behavior: Standardized commands across different package management interfaces.
In addition to these core benefits, DNF5 enhances Fedora’s user experience in containers and on the desktop, supports reproducible builds, and adopts “tuned” as the default power management daemon for Fedora Workstation and other editions.
dnf and dnf5: Understanding the Symlink
In Fedora 41 and newer, the dnf
command is a symlink to dnf5
. This ensures backward compatibility while transitioning to the new package manager. You can confirm this by running:
ls -l $(which dnf)
This will display something like:
lrwxrwxrwx. 1 root root 4 Nov 12 12:00 /usr/bin/dnf -> dnf5
This means you can use either dnf
or dnf5
interchangeably for all commands, including dnf5 install
.
The dnf5 install Command
The dnf5 install
command is the cornerstone of package management in Fedora, allowing users to easily install individual packages, groups, and environments. It ensures dependencies are resolved and installed automatically.
Syntax:
dnf5 install [options] <package-spec>|@<group-spec>|@<environment-spec>...
<package-spec>
: The name or path of the package to install.@<group-spec>
: A collection of packages (e.g.,@development-tools
).@<environment-spec>
: A predefined environment of multiple groups (e.g.,@kde-desktop
).
This versatile syntax accommodates diverse use cases, from single packages to complex group installations.
Key Options for dnf5 install
The dnf5 install
command offers several options for resolving dependencies, handling conflicts, and customizing installations.
Dependency and Conflict Management
--allowerasing
: Removes conflicting packages to resolve dependencies.--skip-broken
: Skips packages with dependency issues, preventing transaction failures.--skip-unavailable
: Ignores unavailable packages and proceeds with accessible ones.--allow-downgrade
: Permits downgrading packages if required.--no-allow-downgrade
: Prevents any downgrades during the operation.
Advanced Installation Options
--downloadonly
: Downloads the specified packages without installing them.--offline
: Stores the transaction for execution offline.
Advisory-Based Installation
For targeted updates, DNF5 allows filtering based on advisories, CVEs, or bug fixes:
--advisories=ADVISORY_NAME,...
: Installs packages tied to specific advisories.--advisory-severities=SEVERITY,...
: Filters advisories by severity (e.g.,critical
,important
).--bzs=BUGZILLA_ID,...
: Targets fixes for specific Bugzilla IDs.--cves=CVE_ID,...
: Addresses vulnerabilities identified by CVE IDs.--security
: Installs only security-related updates.--bugfix
: Focuses on bug-fix updates.--enhancement
: Adds enhancements or new features.--newpackage
: Installs newly added packages.
Practical Examples
Installing a Single Package
dnf5 install vim
Installs the vim
package and its dependencies.
Installing from a Local RPM File
dnf5 install ~/downloads/custom-tool-1.2.3.rpm
Installs a package from a local file.
Installing a Specific Version of a Package
Installing a Package Group
dnf5 install nginx-1.20.1
Installs a specific version of nginx
, upgrading or downgrading if necessary.
Installing a Package Group
dnf5 install /path/to/package/custom-tool-2.3.0.rpm
Installs the “Development Tools” group, including compilers and debugging utilities.
Installing a Desktop Environment
dnf5 install @kde-desktop
Installs the KDE desktop environment along with related packages.
Downloading Without Installing
dnf5 install --downloadonly firefox
Installing Security Updates
dnf5 install --security
Applies only security-related updates to the system.
Installing Packages from an Advisory
dnf5 install --advisories=FEDORA-2024-01234
Installs all packages associated with the specified advisory.
Skipping Broken Packages
dnf5 install package-name --skip-broken
Proceeds with the installation while skipping any packages with unresolved dependencies.
Using –allowerasing to Resolve Conflicts
dnf5 install php --allowerasing
If a conflicting version of php
or a related dependency is already installed, this command removes the conflicting packages and installs the specified version of php
.
dnf5 install mysql --allowerasing
If mariadb
(a MySQL alternative) is installed, this command removes mariadb
and installs mysql
.
Downgrading a Package
dnf5 install mysql-5.7.35 --allow-downgrade
This downgrades the mysql
package to version 5.7.35
. The --allow-downgrade
option is required when installing an older version of a package.
Conclusion
The dnf5 install
command is a robust and flexible tool for managing Fedora packages. Whether you’re installing a single package, updating a group, or targeting specific advisories, DNF5 provides the options you need for efficient system management.
Remember, since dnf
is symlinked to dnf5
, you can use either command interchangeably:
dnf install package-name
Fedora 41’s shift to DNF5 ensures faster, leaner, and more efficient package management for all users.