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
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> ...
If you install packages on a system that supports multiple architectures, such as
i686
andx86_64
, you can specify the architecture of the package by appending it to the package name:# dnf install <package_name>.<architecture>
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>
To install a local RPM file, enter:
# dnf install <path_to_RPM_file>
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.
Additional resources
5.2. Installing package groups
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>
5.3. Installing modular content
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>
For example, to list the details about the
nodejs
module, enter:# dnf module list nodejs Name Stream Profiles Summary nodejs 18 common [d], development, minimal, s2i Javascript runtime nodejs ... common [d], development, minimal, s2i Javascript runtime Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Install a module:
# dnf module install <module_name>:<stream>/<profile>
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 stream18
of thenodejs
module, enter:# dnf module install nodejs:18 ===================================================================================================== Package Architecture Version Repository Size ===================================================================================================== Installing group/module packages: nodejs x86_64 ... rhel-9-for-x86_64-appstream-rpms 12 M npm x86_64 ... rhel-9-for-x86_64-appstream-rpms 2.5 M Installing weak dependencies: nodejs-docs noarch .. rhel-9-for-x86_64-appstream-rpms 7.6 M nodejs-full-i18n x86_64 .. rhel-9-for-x86_64-appstream-rpms 8.4 M Installing module profiles: nodejs/common Enabling module streams: nodejs 18
Verification
Verify that the correct module stream is enabled (
[e]
) and the required profile was installed ([i]
):# dnf module list nodejs Updating Subscription Management repositories. Last metadata expiration check: 0:33:24 ago on Mon 24 Jul 2023 04:59:01 PM CEST. Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs) Name Stream Profiles Summary nodejs 18 [e] common [d] [i], development, minimal, s2i Javascript runtime ... Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Additional resources
5.4. Defining custom default module streams and profiles
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 Name Stream Profiles Summary nodejs 18 common [d], development, minimal, s2i Javascript runtime
In this example,
nodejs:18
is 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.yaml
file with the following content to define18
as the default stream andminimal
as the default profile for thenodejs
module:document: modulemd-defaults version: 1 data: module: nodejs stream: "18" profiles: '18': [minimal]
Verification
Use the
dnf module list <module_name>
command to verify the new default stream and profile settings, for example:# dnf module list nodejs Name Stream Profiles Summary nodejs 18 [d] common, development, minimal [d], s2i Javascript runtime
Additional resources