CentOS Stream 9 Software Installation and AppStreams

It is doubtful that a newly installed CentOS Stream 9 system will contain all 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 CentOS 9, explains how these issues are addressed, explains repositories, software packages, and the CentOS Application Stream (AppStream), and explores how to list, install and remove the software packages that make up a functioning CentOS 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.

Various packages will be installed when CentOS 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 CentOS 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: Shell Session (shell)

When such a command is issued, the requested software is downloaded from a remote repository and installed on the local system. CentOS 9 is configured to download software from repositories named BaseOS, AppStream, and Extras by default. 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 CentOS Stream 9 Essentials. Buy the full book now in eBook or Print format.

Full book includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf repolist
repo id                       repo name
appstream                     CentOS Stream 9 - AppStream
baseos                        CentOS Stream 9 - BaseOS
extras-common                 CentOS Stream 9 - Extras packagesCode language: plaintext (plaintext)

The above example shows that the Appstream, BaseOS, and Extras repositories are enabled. Remember that repositories may be added for third-party software.

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: Shell Session (shell)

The BaseOS Repository

The BaseOS repository contains the packages that make up the core functionality of the operating system. These software elements are downloaded as Red Hat Package Manager (RPM) package files and installed on the system. A typical CentOS 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
libgcc-11.3.1-4.4.el9.x86_64
fonts-filesystem-2.0.5-7.el9.1.noarch
linux-firmware-whence-20230404-134.el9.noarch
crypto-policies-20230505-1.gitf69bbc2.el9.noarch
Code language: plaintext (plaintext)

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

# dnf listCode language: Shell Session (shell)

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

 

You are reading a sample chapter from CentOS Stream 9 Essentials. Buy the full book now in eBook or Print format.

Full book includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf search "search string"Code language: Shell Session (shell)

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

# dnf provides filenameCode language: Shell Session (shell)

When using dnf provides, using the wildcard character (*) when searching for a file is often necessary. For example:

# dnf provides */httpd.conf
Last metadata expiration check: 0:02:21 ago on Mon 29 May 2023 04:02:44 AM EDT.
httpd-core-2.4.53-7.el9.x86_64 : httpd minimal core
Repo        : appstream
Matched from:
Filename    : /etc/httpd/conf/httpd.conf
Filename    : /usr/lib/tmpfiles.d/httpd.confCode language: plaintext (plaintext)

To install a package, run the following command:

# dnf install packagenameCode language: Shell Session (shell)

Similarly, to delete a package:

# dnf delete packagenameCode language: Shell Session (shell)

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 CentOS Stream 9 Essentials. Buy the full book now in eBook or Print format.

Full book includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf updateCode language: Shell Session (shell)

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 CentOS 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 it 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 were released.

To address this issue, the CentOS 9 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. For example, the nodejs JavaScript runtime environment module is available for installation using either the development or minimal profiles. The development profile would most likely be used on a system where development is taking place using nodejs. When the software developed using nodejs is deployed, the minimal system containing just the runtime might be installed instead.

 

You are reading a sample chapter from CentOS Stream 9 Essentials. Buy the full book now in eBook or Print format.

Full book includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

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

# dnf module list
Last metadata expiration check: 0:06:18 ago on Mon 29 May 2023 04:02:44 AM EDT.
CentOS Stream 9 - AppStream
Name       Stream  Profiles                                Summary
maven      3.8     common [d]                             Java project management and project comprehension tool
nginx      1.22    common [d]                             nginx webserver
nodejs     18      common [d], development, minimal, s2i  Javascript runtime
php        8.1     common [d], devel, minimal             PHP scripting language
postgresql 15      client, server [d]                     PostgreSQL server and client module
ruby       3.1     common [d]                             An interpreter of object-oriented scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalledCode language: plaintext (plaintext)

The first column in the list is the module’s name, and the second is the stream name (typically the module’s version). 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 and indicates 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: Shell Session (shell)

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

# dnf module list php
Name       Stream       Profiles                        Summary 
php        8.1 [d]      common [d], devel, minimal     PHP scripting languageCode language: plaintext (plaintext)

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.

 

You are reading a sample chapter from CentOS Stream 9 Essentials. Buy the full book now in eBook or Print format.

Full book includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

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: Shell Session (shell)

For example:

# dnf install @phpCode language: Shell Session (shell)

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

# dnf install @modulename:stream Code language: Shell Session (shell)

For example:

# dnf install @php:8.1Code language: Shell Session (shell)

Finally, a profile may also be declared as follows:

 

You are reading a sample chapter from CentOS Stream 9 Essentials. Buy the full book now in eBook or Print format.

Full book includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf install @modulename:stream/profileCode language: Shell Session (shell)

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

# dnf install @php:8.1/minimalCode language: Shell Session (shell)

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: plaintext (plaintext)

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: plaintext (plaintext)

Similarly, a stream may be disabled as follows:

# dnf module disable modulenameCode language: plaintext (plaintext)

To uninstall a module, use the following syntax:

 

You are reading a sample chapter from CentOS Stream 9 Essentials. Buy the full book now in eBook or Print format.

Full book includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf module remove modulenameCode language: Shell Session (shell)

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

# dnf module info modulenameCode language: Shell Session (shell)

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: Shell Session (shell)

For example:

# dnf module info --profile php:8.1
Updating Subscription Management repositories.
Last metadata expiration check: 1:44:32 ago on Mon 29 May 2023 04:02:44 AM EDT.
Name    : php:8.1:920220706080036: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-commonCode language: plaintext (plaintext)

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

# dnf install @modulename:otherstreamCode language: Shell Session (shell)

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:

 

You are reading a sample chapter from CentOS Stream 9 Essentials. Buy the full book now in eBook or Print format.

Full book includes 34 chapters and 290 pages. Learn more.

Preview  Buy eBook Buy Print

 

# dnf distro-syncCode language: Shell Session (shell)

Summary

The CentOS Stream 9 system comprises RPM format software packages downloaded and installed from the CentOS Stream 9 BaseOS, AppStream, and Extras 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 the creation of modules and profiles 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