Chapter 5. Installing RHEL 9 content
In the following sections, learn how to install content in Red Hat Enterprise Linux 9 by using DNF.
5.1. Installing packages Copy linkLink copied to clipboard!
If a software is not part of the default installation, you can manually install it. DNF automatically resolves and installs dependencies.
Prerequisites
- Optional: You know the name of the package you want to install.
- If the package you want to install is provided by a module stream, the respective module stream is enabled.
Procedure
Use one of the following methods to install packages:
To install packages from the repositories, enter:
dnf install <package_name_1> <package_name_2> ...
# dnf install <package_name_1> <package_name_2> ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you install packages on a system that supports multiple architectures, such as
i686andx86_64, you can specify the architecture of the package by appending it to the package name:dnf install <package_name>.<architecture>
# dnf install <package_name>.<architecture>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To install a package if you only know the path to the file the package provides but not the package name, you can use this path to install the corresponding package:
dnf install <path_to_file>
# dnf install <path_to_file>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To install a local RPM file, enter:
dnf install <path_to_RPM_file>
# dnf install <path_to_RPM_file>Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the package has dependencies, specify the paths to these RPM files as well. Otherwise, DNF downloads the dependencies from the repositories or fails if they are not available in the repositories.
5.2. Installing package groups Copy linkLink copied to clipboard!
Package groups bundle multiple packages, and you can use package groups to install all packages assigned to a group in a single step.
Prerequisites
Procedure
Install a package group:
dnf group install <group_name_or_ID>
# dnf group install <group_name_or_ID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.3. Installing modular content Copy linkLink copied to clipboard!
For certain software, Red Hat provides modules. You can use modules to install a specific version (stream) and set of packages (profiles).
Procedure
List modules that provide the package you want to install:
dnf module list <module_name>
# dnf module list <module_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example, to list the details about the
nodejsmodule, enter:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install a module:
dnf module install <module_name>:<stream>/<profile>
# dnf module install <module_name>:<stream>/<profile>Copy to Clipboard Copied! Toggle word wrap Toggle overflow If a default profile for a stream is defined, you can omit
/<profile>in the command to install this default profile of the stream.NoteIn Red Hat Enterprise Linux 9, no default module streams are predefined. However, if you specify the stream during the module installation as shown, you do not have to manually enable the stream in advance.
For example, to install the default profile (
common) from stream18of thenodejsmodule, enter:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that the correct module stream is enabled (
[e]) and the required profile was installed ([i]):Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4. Defining custom default module streams and profiles Copy linkLink copied to clipboard!
Red Hat Enterprise Linux 9 does not define default streams in the AppStream repository. However, you can configure a default module stream and default module profile. In this case, you can omit this information when you install the default stream and profile of a module.
Procedure
Use the
dnf module list <module_name>command to display the available streams and their profiles, for example:dnf module list nodejs
# dnf module list nodejs Name Stream Profiles Summary nodejs 18 common [d], development, minimal, s2i Javascript runtimeCopy to Clipboard Copied! Toggle word wrap Toggle overflow In this example,
nodejs:18is not set as the default stream, and the default profile in this stream iscommon.Create a YAML file in the
/etc/dnf/modules.defaults.d/directory to define the default stream and profile for a module.For example, create the
/etc/dnf/modules.defaults.d/nodejs.yamlfile with the following content to define18as the default stream andminimalas the default profile for thenodejsmodule:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Use the
dnf module list <module_name>command to verify the new default stream and profile settings, for example:dnf module list nodejs
# dnf module list nodejs Name Stream Profiles Summary nodejs 18 [d] common, development, minimal [d], s2i Javascript runtimeCopy to Clipboard Copied! Toggle word wrap Toggle overflow