4 Installing Software on Oracle Linux

Regardless of whether you use ULN or an Oracle Linux yum server, software packages are installed on a system by using standard dnf commands and depend on the system having the appropriate ULN channel subscriptions or yum repositories enabled.

Use the dnf install command to install a package and any of its dependencies:

sudo dnf install package_name

Note:

dnf makes no distinction between installing and upgrading a kernel package. Both dnf install and dnf upgrade always download the latest kernel available for the system's OS.

The system notifies you of any extra packages that might be installed and prompts you to confirm whether to go ahead with the installation:

Last metadata expiration check: 0:03:03 ago on Mon 11 Sep 2023 11:48:58 AM GMT.
Dependencies resolved.
=======================================================================================================
 Package              Architecture           Version                      Repository              Size
=======================================================================================================
Installing:
 dnf-automatic        noarch                 4.14.0-5.0.1.el9_2           ol9_baseos_latest        53 k

Transaction Summary
=======================================================================================================
Install  1 Package

Total download size: 53 k
Installed size: 52 k
Is this ok [y/N]: 
 

You can bypass the confirmation check in a dnf install command by using the -y option.

For a list of dnf commands that are commonly used to manage DNF packages and repositories, see DNF Command References.

Using DNF Groups

A set of packages can be organized and managed as a group. Groups can be nested so that a parent group contains a set of subgroups that can be installed. Examples include the groups for setting up a virtualization host, a graphical desktop, a collection of fonts, or core system administration tools. The following table shows the dnf commands that you can use to manage these groups.

When installing a group package, use the following command:

sudo dnf group install group-name

For a list of dnf commands that are commonly used to manage DNF groups, see Table 7-2 of DNF Command References.

Using DNF Modules and Application Streams

DNF introduces the concepts of modules, streams, and profiles for managing different versions of software applications within a single OS release. Modules can be used to group many packages that consist of a single application and its dependencies. Streams can be used to provide alternative versions of the same module. Profiles can be used to define optional configurations of any single module so that a module can be limited only to developer packages or can be scoped to include other packages for enhanced functionality.

Modular content is made available separate to core OS packages so that these user-space applications can be installed in various user-space environments, including virtual machines, containers, and the base OS. Modular content for Oracle Linux 8 and Oracle Linux 9 is typically shipped within the Application Stream (AppStream) repository.

For a list of application stream packages in the latest Oracle Linux version, see Oracle Linux: Product Life Cycle Information.

  • Modules: Are a set of RPM packages that are grouped together and must be installed together. They can contain several streams that consist of several versions of applications that you can install. You enable a module stream to provide system access to the RPM packages that are contained in that module stream.

    A typical module can contain the following types of packages:

    • Packages with an application

    • Packages with the application's specific dependency libraries

    • Packages with documentation for the application

    • Packages with helper utilities

  • Module streams: Hold different versions of content contained within a module.

    Modules can have several streams, where each stream contains a different version of packages and their dependencies. Each stream receives updates independently. A module can have more than one stream. However, note that for each module, only one of its streams can be enabled to provide access to its packages. Often, the stream with the latest version is selected as the default stream and is used when operations don't specify a particular stream or a different stream hasn't been enabled before.

    Module streams can be thought of as virtual repositories within the physical repository. For example, the postgresql module provides the PostgreSQL database in streams 9.6 and 10, with version 10 being the current default stream.

    Note:

    We recommend that you use the latest stream for any module that's installed, even though other streams might continue to receive limited support.

  • Module profiles: Provide a list of certain packages that are to be installed at the same time for a particular use case. At the same time, profiles are also a recommendation by the application packagers and experts. Note that each module can have one or more profiles.

    You install packages by using a module's profile as a one-time action. Using a module's profile to install packages doesn't prevent you from installing or uninstalling any of the packages that are provided by the module. Furthermore, you can install packages by using the profiles of the same module without any further preparation. Also, a module's package list can contain packages from outside of the module stream. These packages are often from BaseOS or the stream's own dependencies. Note that modules in Application Stream always have a default profile. This default profile is used for installations, when no other profile is explicitly specified.

    For example, The httpd module that includes the Apache web server includes the following profiles for installation:

    • common: This profile is a hardened production-ready deployment and is the default profile.

    • devel: This profile installs the packages that are necessary to make modifications to httpd.

    • minimal: This profile installs the smallest set of packages that provide a running web server.

Unlike software collections that were included in previous releases of Oracle Linux, applications that are installed from Application Streams are installed into standard locations and don't require extra commands or actions to run. You can run any version of an installed application the same way as any other version, regardless of the stream from which it was installed. After it's installed, the application behaves exactly as any other native application that you have installed by using DNF.

To manage modules, you use a combination of dnf and dnf module subcommands. For a list of dnf commands that are commonly used with modules, see Table 7-3 of DNF Command References.

About Modular Dependencies and Stream Changes

Typically, packages that provide content depend on other packages and specify the appropriate dependency versions. This same mechanism also applies to packages that are contained within modules. The grouping of packages and their particular versions into modules and streams has some extra constraints. For example, module streams can declare dependencies on the streams of other modules, independent of the packages that the modules contain and provide. After any package or module operation, the entire dependency tree for all the underlying installed packages must satisfy all the conditions that the packages declare. Likewise, all the module stream dependencies must satisfied.

These extra constraints require that you analyze and understand the implications before performing any package operation. Changing the enabled module streams doesn't automatically manipulate packages to enable you to have complete control over the changes. However, the tool always provides a summary of the actions to take.

When performing package operations on modules and streams, keep the following guidelines, caveats, and warnings in mind:

  • Enabling a module stream might also require the enabling of streams of other modules.

  • Installing a module stream profile or packages from a stream might also require the enabling of streams of other modules and the installation of extra packages.

  • Disabling a stream of a module might also require the disabling of other module streams, as no packages are removed automatically.

  • Removing a package can require the removal of other packages. If any of the packages are provided by modules, the module streams remain enabled in preparation for further installation, even if no packages from these streams are installed later; thereby, mirroring the behavior of an unused yum repository.

  • Switching the stream that's enabled for a module is the same as resetting the current stream and enabling a new stream.

    Note:

    Switching an enabled stream doesn't automatically change any of the installed packages. Also, removing packages that are provided by a previous stream, and any of the packages that depend on them, and the installation of packages in a new stream are all tasks that must be performed manually.

  • Because of potential upgrade scripts that run during an installation, directly installing a stream of a module, other than one that's already installed by default, isn't recommended.

Module dependencies include regular package dependencies that are similar to RPM dependencies. For modules, however, availability can also depend on the enabling of module streams; module streams can also depend on other module streams.

Dependencies of non modular packages on modular packages are used in Application Stream only when a modular package is provided by a module stream that's marked as the default. When a modular package depends on a non modular package, the system always retains the module and stream choices, unless you provide explicit instructions to change them. A modular package receives updates from the enabled stream of the module that provides this package and doesn't upgrade to a version from a different stream.

How to Enable Modules

Selected modules are available by default when you install Oracle Linux. You can install these modules as needed. Note that directly installing a stream of a module, other than one that's installed by default, might cause unexpected issues.

This task uses the example of the PHP module to show you how to enable modules.

As an alternative, you can the dnf module switch-to command for this task. See Table 7-3.

  1. Check the status of the module.
    sudo dnf module list php
    Oracle Linux 8 Application Stream (x86_64)
    Name           Stream            Profiles                            Summary                        
    php            7.2 [d]           common [d], devel, minimal          PHP scripting language         
    php            7.3               common [d], devel, minimal          PHP scripting language         
    php            7.4               common [d], devel, minimal          PHP scripting language         
    php            8.0               common [d], devel, minimal          PHP scripting language         
    
    Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

    Each PHP version has 3 corresponding profiles, with the common profile as the default. The [d] flag indicates the default version of the profile.

  2. List the packages that are installed for the profiles associated with the module stream.
    sudo dnf module info --profile php:8.0

    The output displays each profile and its associated packages that are required for the module. For example:

    Name    : php:8.0:8060020211215065547:0a326c83:x86_64
    common  : php-cli
            : php-common
            : php-fpm
            : php-mbstring
            : php-xml
    ...
  3. Enable the module stream you want to use.
    sudo dnf module enable php:8.0 -y
  4. Optionally, check the status of the selected stream to verify that it has the e flag.
    sudo dnf module list php
    Name           Stream            Profiles                            Summary                        
    php            7.2 [d]           common [d], devel, minimal          PHP scripting language         
    php            7.3               common [d], devel, minimal          PHP scripting language         
    php            7.4               common [d], devel, minimal          PHP scripting language         
    php            8.0 [e]           common [d], devel, minimal          PHP scripting language
  5. To switch to a preferred module stream, see How to Switch Module Streams.

How to Remove Installed Modules

Removing an installed module removes all the packages and their dependencies that are installed by the profiles of the enabled module stream.

The modules to be removed must have some profiles already installed.

Before removing an installed module, review the information in About Modular Dependencies and Stream Changes.

This task only removes packages that are listed in profiles of the operational module stream. Packages that aren't listed in any of module stream's profiles remain installed on the system and can be removed manually. At each step, a summary of pending changes is first displayed and you're prompted to confirm the action before proceeding.

  1. Remove the module.
    sudo dnf module remove module-name
  2. Disable the module stream.
    sudo dnf module disable module-name
  3. Remove any packages that you manually installed from the module stream.
    sudo dnf remove package ...

How to Switch Module Streams

By switching module streams, you can obtain a different version of the current module that's being used in the system.

The module stream that you want to switch must already be enabled and, at the same time, another stream of the same module must already exist.

Before switching module streams, review the information in About Modular Dependencies and Stream Changes.

Switching to a different module stream effectively causes the content to be either upgraded or downgraded to a version that's different from the current version on the system.

In some steps, a summary of pending changes is first displayed and you're prompted to confirm the action before proceeding.

You can also use the dnf module switch-to command for this task. See Table 7-3.

  1. Reset the module to enable you to install an alternative stream.
    sudo dnf module reset module-name
  2. Install the profiles of a different stream of the module.
    sudo dnf install @module-name:stream

    You might also need to apply changes to other module streams and packages.

  3. Update or downgrade any packages installed from the previous module stream that weren't listed in the profiles installed in the previous step.
    sudo dnf distro-sync
  4. Manually remove any remaining packages that were installed from the previous module stream.
    sudo dnf remove package ...