Understanding RHEL 9 Packages, Repositories, and AppStreams

It is doubtful that a newly installed RHEL 9 system will contain all of the software packages to perform the tasks for which it is intended. Even once all the required software has been installed, it is almost certain that newer versions of many of those packages will be released during the system’s lifespan. In some cases, you will need to ensure that these latest package releases are installed on the system to fix any bugs. In other cases, however, an older version of a particular software package may need to be kept on the system for compatibility with other software.

This chapter introduces the basic concepts of software management on RHEL 9, explains how these issues are addressed, introduces the concepts of repositories, software packages, and the Red Hat Application Stream (AppStream), and explores how to list, install and remove the software packages that make up a functioning RHEL 9 system.

Repositories

Linux is essentially comprised of a set of base packages that provide the core functionality of the operating system together with a range of other packages and modules that add functionality and features on top of the base operating system.

Several packages will be installed when RHEL 9 is first installed, depending on the software options selected during the installation phase. Once the system is up and running, however, additional software can be installed as needed. Typically, all software that is part of RHEL 9 (in other words, software that a third-party vendor does not provide) is downloaded and installed on the system using the dnf command. As we have seen in earlier chapters, this typically consists of a command similar to the following being issued at the command prompt:

# dnf install httpdCode language: PHP (php)

When such a command is issued, the requested software is downloaded from a remote repository and installed on the local system. By default, RHEL 9 is configured to download software from repositories named BaseOS and AppStream. For example, running the following command will provide a list of the repositories the system is currently configured to use when downloading software:

 

You are reading a sample chapter from Red Hat Enterprise Linux 9 Essentials. Buy the full book now in eBook or Print format.

Includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf repolist
Updating Subscription Management repositories.
repo id                                repo name
rhel-9-for-x86_64-appstream-rpms       Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)
rhel-9-for-x86_64-baseos-rpms          Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)

The above example shows that repositories for both AppStream and BaseOS are enabled on the system. Remember that repositories may be added for third-party software, as is the case for the Google Chrome repository listed above.

Additional repositories may be added to the system by placing entries in the /etc/dnf/dnf.conf file, or by adding .repo files to the /etc/yum.repos.d/ directory. Alternatively, the repository may be added using the dnf config-manager tool, passing the URL of the .repo file for the repository as a command-line argument:

# dnf config-manager --add-repo https://url/of/repo/fileCode language: PHP (php)

The BaseOS Repository

The BaseOS repository contains the packages that make up the core functionality of the operating system. These software elements are downloaded in the form of Red Hat Package Manager (RPM) package files and then installed on the system. A typical RHEL 9 system will have around 1500 RPM packages installed. To see a list of all the RPM packages currently installed on the system, run the rpm command as follows:

# rpm -qa | more
qemu-kvm-block-rbd-2.12.0-41.el8+2104+3e32e6f8.x86_64
kyotocabinet-libs-1.2.76-17.el8.x86_64
cyrus-sasl-scram-2.1.27-0.3rc7.el8.x86_64
curl-7.61.1-5.el8.x86_64
.
.Code language: PHP (php)

A list of packages available for installation from the BaseOS repository is available by running the dnf command as follows:

# dnf listCode language: PHP (php)

To obtain a list of packages that match a search string, use dnf as follows:

 

You are reading a sample chapter from Red Hat Enterprise Linux 9 Essentials. Buy the full book now in eBook or Print format.

Includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf search "search string"Code language: PHP (php)

It is also possible to identify which package contains a specific file:

# dnf provides filename Code language: PHP (php)

For example:

Updating Subscription Management repositories.
httpd-2.4.51-7.el9_0.x86_64 : Apache HTTP Server
Repo        : rhel-9-for-x86_64-appstream-rpms
Matched from:
Filename    : /etc/httpd/conf/httpd.conf

httpd-core-2.4.53-7.el9.x86_64 : httpd minimal core
Repo        : rhel-9-for-x86_64-appstream-rpms
Matched from:
Filename    : /etc/httpd/conf/httpd.conf

httpd-core-2.4.53-7.el9_1.1.x86_64 : httpd minimal core
Repo        : rhel-9-for-x86_64-appstream-rpms
Matched from:
Filename    : /etc/httpd/conf/httpd.conf

To install a package, run the following command:

# dnf install packagenameCode language: PHP (php)

Similarly, to delete a package:

# dnf delete packagenameCode language: PHP (php)

When a newer version of a package is made available, it will be downloaded and installed when the system is next updated, typically via the dnf command:

 

You are reading a sample chapter from Red Hat Enterprise Linux 9 Essentials. Buy the full book now in eBook or Print format.

Includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf updateCode language: PHP (php)

Any updated packages will replace the older version currently installed on the system. While this is generally the ideal situation when working with base operating system packages, this is not necessarily the desired behavior when dealing with other packages, such as programming environments or development libraries, where upgrading to a new version may cause compatibility issues with other packages installed on the system. This issue is addressed by the AppStream repository.

The AppStream Repository

The AppStream repository manages software in terms of packages, modules, streams, and profiles. AppStream packages are, once again, RPM packages, as outlined in the previous section describing BaseOS. AppStream modules, on the other hand, are groups of packages that belong together or for which dependencies exist (for example, the group of packages that would need to be installed together when building a web server). Each module can have multiple streams, where each module stream represents a different version of the software module.

Consider, for example, a RHEL 9 system hosting a website that depends on version 7.2 of the PHP scripting language. The server still needs to receive any updates to PHP 7.2 to benefit from patches and bug fixes but is not compatible with the latest version of PHP (version 8.1). Before the introduction of AppStream, it would have been difficult to continue receiving version 7.2 updates when newer versions have been released.

To address this issue, the RHEL software management tools can use the AppStream repository to subscribe only to a specific stream for a specific module (in this case, the version 7.2 stream of the PHP module).

In addition to streams, modules may also be sub-classed by module profile. Module profiles provide different configurations of packages that make up a module to be installed, dependent on the requirements of the system. The nodejs JavaScript runtime environment module, for example, is available for installation using either the development or minimal profiles. On a system where development is taking place using nodejs, the development profile would most likely be used.

 

You are reading a sample chapter from Red Hat Enterprise Linux 9 Essentials. Buy the full book now in eBook or Print format.

Includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

When the software developed using nodejs is deployed, the minimal system containing just the runtime might be installed instead.

To view the list of modules available for installation, use the dnf command as follows:

# dnf module list
Updating Subscription Management repositories.
Last metadata expiration check: 1:27:42 ago on Mon 27 Mar 2023 11:02:15 AM EDT.
Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)
Name     Stream    Profiles                                Summary
maven    3.8       common [d]                              Java project management and project comprehension tool
nodejs   18        common [d], development, minimal, s2i   Javascript runtime
php      8.1       common [d], devel, minimal              PHP scripting language
.
.
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

The first column in the list is the name of the module, and the second is the stream name (which is typically the version of the module). The letter after the stream name ([d]) indicates whether the stream is the default (i.e., this is the stream that will be used for installation if no specific stream is referenced) or if it has been enabled for use when performing installations. The third column lists the profiles available for the corresponding package together with an indication of whether the profile is the default, has been installed, or is disabled.

The dnf command to list information about a specific module is structured as follows:

# dnf module list modulenameCode language: PHP (php)

The following output, for example, lists information about the PHP modules available for installation:

 

You are reading a sample chapter from Red Hat Enterprise Linux 9 Essentials. Buy the full book now in eBook or Print format.

Includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf module list php
.
.
Name       Stream       Profiles                        Summary
php        8.1 [d]      common [d], devel, minimal     PHP scripting language

Clearly, PHP version 8.1 will be installed on the system by default, and the module is available in common, development, and minimal profile configurations.

To install a module using the default stream and profile, the dnf command can be used with the following syntax:

# dnf install @modulename Code language: CSS (css)

For example:

# dnf install @phpCode language: CSS (css)

Alternatively, a specific stream may be specified from which to perform the installation:

# dnf install @modulename:streamCode language: PHP (php)

Understanding RHEL 9 Software Installation and Management For example:

 

You are reading a sample chapter from Red Hat Enterprise Linux 9 Essentials. Buy the full book now in eBook or Print format.

Includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf install @php:8.1Code language: PHP (php)

Finally, a profile may also be declared as follows:

# dnf install @modulename:stream/profileCode language: PHP (php)

For example, to install the minimal set of packages for PHP 8.1:

# dnf install @php:8.1/minimalCode language: PHP (php)

After installing the module using the above command, the PHP modules will now be listed as follows:

php 8.1 [e] common [d], devel, minimal [i] PHP scripting language Code language: CSS (css)

The “[e]” indicator in the stream column tells us that the 8.1 stream has been enabled, while the “[i]” in the profile column shows that the module has been installed using the minimal profile. To enable a stream without installing a module, use dnf as follows:

# dnf module enable modulenameCode language: PHP (php)

Similarly, a stream may be disabled as follows:

 

You are reading a sample chapter from Red Hat Enterprise Linux 9 Essentials. Buy the full book now in eBook or Print format.

Includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf module disable modulenameCode language: PHP (php)

To uninstall a module, use the following syntax:

# dnf module remove modulenameCode language: PHP (php)

Additional information about a module may be identified using the following dnf command:

# dnf module info modulenameCode language: PHP (php)

To find out which RPM packages make up the different profiles of a specific module and stream combination, use dnf as follows:

# dnf module info --profile modulename:stream Code language: CSS (css)

For example:

# dnf module info --profile php:8.1
Updating Subscription Management repositories.
Last metadata expiration check: 1:44:32 ago on Mon 27 Mar 2023 11:02:15 AM EDT.
Name    : php:8.1:9010020220706080036:9:x86_64
common  : php-cli
        : php-common
        : php-fpm
        : php-mbstring
        : php-xml
devel   : php-cli
        : php-common
        : php-devel
        : php-fpm
        : php-mbstring
        : php-pecl-zip
        : php-process
        : php-xml
minimal : php-cli
        : php-common

Finally, to switch from one module stream to another, run the installation command referencing the new stream as follows:

 

You are reading a sample chapter from Red Hat Enterprise Linux 9 Essentials. Buy the full book now in eBook or Print format.

Includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf install @modulename:otherstreamCode language: PHP (php)

This command will download the packages for the new stream and either upgrade or downgrade the existing packages to the specified version. Once this process is complete, resynchronize module packages for the new stream:

# dnf distro-syncCode language: PHP (php)

Summary

The RHEL 9 system comprises RPM format software packages that are downloaded and installed from the Red Hat BaseOS and AppStream repositories. Additional repositories can be added to the system for installation packages as needed.

The BaseOS repository contains the packages that implement the base core functionality of the operating system. The AppStream packages, on the other hand, provide additional features and functionality that will be installed selectively depending on the purpose for which the system is being configured. In a complex system, there can be a significant amount of package interdependency where part of the system may require a specific version of another software package to function correctly. AppStreams allow modules and profiles to be created that contain all of the dependent packages necessary to install a particular feature together at the correct version level. AppStreams also allow installed packages to receive updates to the current version without downloading the next major version, thereby avoiding disrupting the dependencies of other packages.


Categories