LinuxCommandLibrary

dnf-module

Control DNF module streams

TLDR

View the modularity overview

$ dnf module list
copy

View modularity of a specific program
$ dnf module list [package_name]
copy

Set a package to be enabled
$ sudo dnf module enable [package_name]:[stream]
copy

Enable and install a specific version
$ dnf module install [package_name]:[stream]
copy

SYNOPSIS

dnf module [global-options] action [module[:stream][@profile]] ...

PARAMETERS

list
    List available, installed, enabled, or disabled modules matching specifiers

enable
    Enable specified module streams or profiles

disable
    Disable specified modules

reset
    Reset module or stream state to default

switch-to
    Switch to specified module stream, reinstalling packages if needed

install
    Install specified module stream or profile

remove
    Remove installed module stream or profile

--enabled
    Show only enabled modules (for list)

--disabled
    Show only disabled modules (for list)

--defaults
    Include default streams (for list)

--all
    Show all modules regardless of state (for list)

--installed
    Show only installed modules (for list)

--profiles
    Show available profiles for modules (for list)

-y, --assumeyes
    Automatically answer yes to prompts (global)

-v, --verbose
    Increase verbosity (global)

DESCRIPTION

The dnf module command is a subcommand of the DNF package manager used in RPM-based distributions like Fedora and RHEL to handle modularity. Modularity allows repositories to provide multiple versions (streams) of software packages simultaneously, along with optional profiles defining sets of packages. This enables users to select specific streams (e.g., Node.js 18 or 20) and profiles (e.g., 'default', 'minimal', 'full').

Key actions include listing available modules, enabling or disabling streams for installation, switching between streams, installing or removing modular content, and resetting module states. It integrates with DNF's repository metadata, where modules are defined in comps.xml-like structures with modulemd documents.

This facilitates consistent environments, reproducibility, and parallel installable app streams without conflicts. Note that modularity is primarily used in enterprise distros like RHEL 8/9, but deprecated in recent Fedora releases (40+) in favor of traditional versioning.

CAVEATS

Modularity is deprecated in Fedora 40+; use traditional packages. Not all repos support modules. Switching streams may require removing conflicting packages.

MODULE SPECIFICATION

module:stream@profile format: e.g., nodejs:18/default. Omit stream for default; omit profile for stream default.

EXAMPLES

dnf module list nodejs
dnf module enable nodejs:18
dnf module install postgresql:13/server
dnf module switch-to nginx:1.20

HISTORY

Introduced in Fedora 28 (2018) via Project Modularity for app streams. Adopted in RHEL 8 (2019). Maintained in DNF 4.x; limited support in DNF5 with deprecation in Fedora 40+ (2024).

SEE ALSO

dnf(8), dnf.conf(5), dnf-repoclosure(1), microdnf(1)

Copied to clipboard