Rocky Linux 9 Software Installation and AppStreams

It is doubtful that a newly installed Rocky Linux 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 ensure that any bugs are fixed. 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 Rocky 9, explains how these issues are addressed, explains repositories, software packages, and the Rocky Linux Application Stream (AppStream), and explores how to list, install and remove the software packages that make up a functioning Rocky 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 Rocky 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 Rocky 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: plaintext (plaintext)

When such a command is issued, the requested software is downloaded from a remote repository and installed on the local system. By default, Rocky 9 is configured to download software from repositories named BaseOS, AppStream, and Extras. 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 Rocky Linux 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                       Rocky Linux 9 - AppStream
baseos                          Rocky Linux 9 - BaseOS
extras                          Rocky Linux 9 - Extras
Code language: plaintext (plaintext)

The above example shows that the Appstream, BaseOS, and Extras repositories are enabled on the system. 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: Pony (pony)

The Repository

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

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

# dnf listCode language: plaintext (plaintext)

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

 

You are reading a sample chapter from Rocky Linux 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: plaintext (plaintext)

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

# dnf provides filenameCode language: plaintext (plaintext)

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:03:10 ago on Mon 24 Apr 2023 10:33:24 AM EDT.
httpd-core-2.4.53-7.el9_1.5.x86_64 : httpd minimal core
Repo        : appstream
Matched from:
Filename    : /etc/httpd/conf/httpd.conf
Filename    : /usr/lib/tmpfiles.d/httpd.conf
Code language: plaintext (plaintext)

To install a package, run the following command:

# dnf install packagenameCode language: plaintext (plaintext)

Rocky Linux 9 Software Installation and AppStreams Similarly, to delete a package:

# dnf delete packagenameCode language: plaintext (plaintext)

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

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 Rocky 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 Rocky 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. 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. 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 Rocky Linux 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:08:48 ago on Mon 24 Apr 2023 10:33:24 AM EDT.
Rocky Linux 9 - AppStream
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                                         
ruby     3.1     common [d]                               An interpreter of object-oriented scripting language           

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

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

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

# dnf module list php
.
.
Name       Stream       Profiles                        Summary 
php        8.1 [d]      common [d], devel, minimal     PHP scripting language
Code 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 Rocky Linux 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: plaintext (plaintext)

For example:

# dnf install @phpCode language: plaintext (plaintext)

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

# dnf install @modulename:stream Code language: plaintext (plaintext)

For example:

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

Finally, a profile may also be declared as follows:

 

You are reading a sample chapter from Rocky Linux 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: plaintext (plaintext)

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

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

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

The “[e]” indicator in the stream column tells us that the 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 Rocky Linux 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: plaintext (plaintext)

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

# dnf module info modulenameCode language: plaintext (plaintext)

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

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

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

Summary

The Rocky Linux 9 system comprises RPM format software packages that are downloaded and installed from the Rocky Linux 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 of this nature, 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