DNF5 Group Commands Guide for Fedora Linux

DNF groups simplify Fedora system setup by bundling related packages for specific workflows. Instead of installing compilers, version control tools, and build utilities individually, the Development Tools group handles everything in one command. Groups cover development environments, desktop configurations, web servers, container management, and specialized tasks like 3D printing or scientific computing.

This guide walks through listing available groups, viewing package details, installing mandatory and optional packages, upgrading group definitions after system updates, and removing groups you no longer need. You will also learn to handle hidden groups, resolve dependency conflicts, and troubleshoot common installation issues. By the end, you will confidently manage software collections on Fedora using DNF group commands verified with actual command outputs.

Preparation

Before using DNF group commands, ensure your system is properly set up by following these steps:

Verify Fedora Version

DNF5 became the default package manager in Fedora 41, replacing DNF4. To verify your Fedora version, run:

cat /etc/os-release

Ensure Administrative Privileges

Most DNF commands require administrative rights. Verify that you have sudo access by running:

sudo dnf list installed

If this command lists installed packages without errors, your administrative access is confirmed.

Update Your System

Before working with groups, update your system to ensure you have the latest package definitions and metadata. The --refresh flag forces DNF to download fresh repository metadata rather than using cached data, ensuring you see the most current group definitions:

sudo dnf --refresh update

For additional performance optimization, see our guide on increasing DNF speed on Fedora.

Listing Available Groups

One of the first steps in using DNF group commands is identifying the available groups on your system. Groups are categorized collections of related software packages that simplify installations for specific tasks, like setting up a development environment or configuring desktop tools.

Displaying a List of Groups

To view all available groups, run the following command:

dnf group list

This displays available groups with their IDs, names, and installation status:

ID                          Name                                        Installed
kde-desktop                 KDE                                                no
kde-education               KDE Educational applications                       no
kde-media                   KDE Multimedia support                             no
kde-office                  KDE Office                                         no
libreoffice                 LibreOffice                                        no
network-server              Network Servers                                    no
python-science              Python Science                                     no
rpm-development-tools       RPM Development Tools                              no

Each group includes mandatory packages (always installed), default packages (installed by default when you install the group), and optional packages (require --with-optional).

Example: C Development Group Package Breakdown

The C Development Tools group demonstrates the three-tier structure. Check it with:

dnf group info "C Development Tools and Libraries"

The output shows:

Mandatory packages   : autoconf
                     : automake
                     : gcc
                     : gcc-c++
                     : gdb
                     : make
Default packages     : ccache
                     : ctags
                     : valgrind
Optional packages    : cmake
                     : cproto
                     : nasm

Mandatory packages (gcc, make, gdb) install automatically. Default packages (ccache, valgrind) are installed by default when you install the group. Optional packages (cmake, nasm) require --with-optional for inclusion.

Including Hidden Groups

Some groups are hidden by default. Hidden groups often include specialized software collections that are not displayed in the standard list. To include them, use the --hidden option:

dnf group list --hidden

This reveals specialized collections not shown in the standard list:

ID                          Name                                        Installed
mail-server                 Mail Server                                        no
mysql                       MariaDB (MySQL) Database                           no
ocaml                       OCaml                                              no
perl                        Perl Development                                   no
perl-web                    Perl for Web                                       no
php                         PHP                                                no
platform-vmware             VMware Platform Support                            no

Hidden groups cover database servers (MySQL/MariaDB), programming languages (OCaml, Perl, PHP), and platform-specific tools (VMware). These remain hidden because they serve specialized workflows rather than general desktop or development use.

Viewing Group Information

After listing available groups, you may want to learn more about a specific group. DNF provides detailed information about each group, including its description, mandatory packages, and optional packages.

Displaying Group Details

To view detailed information about a specific group, use the following command:

dnf group info "<group-name>"

Replace <group-name> with the name of the group you want to explore. For example, to view details about the “Development Tools” group, use:

dnf group info "Development Tools"

Understanding Package Tiers

When you run dnf group info, DNF shows which packages are mandatory, default, and optional. For example, Fedora 43 reports:

Id                   : development-tools
Name                 : Development Tools
Description          : These tools include general development tools such as git and CVS.
Installed            : no
Repositories         : fedora, updates
Mandatory packages   : gettext
Default packages     : diffstat
                     : doxygen
                     : git
                     : patch
                     : patchutils
                     : subversion
                     : systemtap
Optional packages    : buildbot
                     : colordiff
                     : cvs
                     : cvs2cl
                     : cvsps
                     : darcs
                     : dejagnu
                     : expect
                     : gambas3-ide
                     : git-annex
                     : git-cola
                     : git2cl
                     : gitg
                     : gtranslator
                     : highlight
                     : lcov
                     : manedit
                     : meld
                     : monotone
                     : myrepos
                     : nemiver
                     : qgit
                     : quilt
                     : rapidsvn
                     : rcs
                     : robodoc
                     : scanmem
                     : subunit
                     : svn2cl
                     : tig
                     : tortoisehg
                     : translate-toolkit
                     : utrac

Use these tiers to control what gets installed:

  • Mandatory: always installed with the group.
  • Default: installed by default when you install the group.
  • Optional: installed only with --with-optional.

Installing a Group

DNF makes it easy to install software groups, allowing you to quickly set up collections of related packages for specific tasks. Installing a group ensures that all mandatory packages are installed, with the option to include additional packages for extended functionality.

Installing a Group with Mandatory Packages

To install a group and its mandatory packages, use:

sudo dnf group install "<group-name>"

Replace <group-name> with the name of the group you want to install. For example, to install the Development Tools group (includes Git, patch utilities, and build tools):

sudo dnf group install "Development Tools"

Include Optional Packages During Installation

If you want to include optional packages during the group installation, add the --with-optional option:

sudo dnf group install "<group-name>" --with-optional

For instance, to install the “Development Tools” group along with its optional packages:

sudo dnf group install "Development Tools" --with-optional

Optional packages extend the group’s functionality, providing additional tools that may not be essential but could enhance your workflow.

Use Group IDs When Names Fail

Group names with spaces or special characters sometimes require the group ID instead. The dnf group list output shows both the ID (left column) and descriptive name (middle column). For example, installing Xfce desktop requires the group ID:

dnf group list

For example, if “Fedora Workstation” doesn’t work, try using the group ID instead:

sudo dnf group install workstation-product-environment

Upgrading a Group

Over time, software groups may receive updates or additional packages. Upgrading a group ensures it is aligned with the latest group definition, adding any new packages introduced since the group was installed.

Upgrading to the Latest Group Definition

To upgrade a group and include any newly added packages, use:

sudo dnf group upgrade "<group-name>"

Replace <group-name> with the name of the group you want to upgrade. For example, to upgrade the Development Tools group after a Fedora system update:

sudo dnf group upgrade "Development Tools"

Why Upgrade a Group?

Group upgrades are particularly useful after a Fedora system update or when maintaining environments that rely on curated package collections. This command ensures your group includes the latest mandatory and optional packages defined by Fedora.

Removing a Group

If a software group is no longer needed, DNF allows you to remove the group and its associated packages to free up system resources. You can also choose to remove the group definition without uninstalling the packages.

Removing a Group and Its Packages

To remove a group along with all its mandatory and optional packages, use:

sudo dnf group remove "<group-name>"

For example, to remove the “Development Tools” group:

sudo dnf group remove "Development Tools"

Remove Group Definition While Retaining Packages

If you want to remove the group definition but keep the installed packages (useful when you need individual packages but no longer want group-level management), use the --no-packages option:

sudo dnf group remove "<group-name>" --no-packages

This is useful when you no longer need to manage a group but wish to retain some or all of the packages it installed.

Customize Group Operations with Advanced Flags

DNF provides several flags to customize group installations, resolve dependency conflicts, and handle unavailable packages. These options work with install, upgrade, and remove commands. For example, when setting up container environments, the Container Management group benefits from optional package inclusion:

Essential Group Flags

  • --with-optional: Installs optional packages within the group alongside the mandatory packages.
  • --allowerasing: Resolves dependency conflicts by removing problematic packages.
  • --skip-unavailable: Skips packages that are unavailable during installation or upgrades, allowing the process to continue smoothly.

Example: Installing Container Management with All Tools

The Container Management group includes podman by default but keeps buildah, flatpak, and toolbox optional. To install everything for a complete container workflow:

sudo dnf group install "Container Management" --with-optional

First, verify what the group includes:

Id                   : container-management
Name                 : Container Management
Description          : Tools for managing Linux containers
Default packages     : podman
Optional packages    : buildah
                     : flatpak
                     : flatpak-builder
                     : skopeo
                     : toolbox

Installing with --with-optional adds buildah (container image building), skopeo (image inspection/copying), and toolbox (containerized development environments) alongside the default podman runtime.

Handling Unavailable Packages

If some packages are missing during installation or upgrade, the --skip-unavailable option prevents the operation from failing:

sudo dnf group upgrade "<group-name>" --skip-unavailable

This is particularly useful when upgrading groups after Fedora version upgrades, where some packages may have been renamed or removed from repositories.

Common Issues and Solutions

While using DNF group commands, you might encounter some common problems. Here are practical solutions to ensure smooth group management.

Group Not Found

If a group name isn’t recognized, it may be due to an incorrect name or a missing group definition. First, verify the group name and ID using the dnf group list command:

dnf group list

The output shows three columns: the group ID (left), descriptive name (middle), and installation status (right):

ID                          Name                                        Installed
kde-desktop                 KDE                                                no
kde-office                  KDE Office                                         no
libreoffice                 LibreOffice                                        no
network-server              Network Servers                                    no
python-science              Python Science                                     no

If the descriptive name fails, use the group ID instead. For example, if “KDE Office” doesn’t work:

sudo dnf group install kde-office

Group IDs never contain spaces, making them more reliable in scripts and automated installations.

Dependency Problems

Dependency conflicts typically occur when a group requires a different version of a package you already have installed. The --allowerasing flag allows DNF to remove conflicting packages and install the versions the group requires:

sudo dnf group install "<group-name>" --allowerasing

If packages remain unavailable despite resolving conflicts, the --skip-broken option bypasses problematic packages and installs everything else:

sudo dnf group install "<group-name>" --skip-broken

Handling Missing Packages

If a group upgrade or installation fails due to unavailable packages, use the --skip-unavailable option to continue without those packages:

sudo dnf group upgrade "<group-name>" --skip-unavailable

This is especially helpful when dealing with custom repositories or after Fedora version upgrades where some packages may no longer be available.

Conclusion

DNF group commands bundle related packages into single-command installations covering development tools, desktop environments, and server configurations. You can now list available groups with dnf group list, inspect package tiers before installation, include optional packages with --with-optional, and upgrade groups after Fedora releases. When descriptive names fail, substitute the group ID, and use --allowerasing to resolve dependency conflicts during complex installations.

Leave a Comment