Install package on oracle linux
Before installing a third-party package, verify if you can install the Python library you need from the Oracle Linux yum server. For example, to check if the requests library has been provided for Python 3:
sudo dnf search python3-requests
For more information about installing additional Python libraries from the Oracle Linux yum server, read Installing Additional Python Libraries.
If you cannot find a particular dependency on the Oracle Linux yum server, or if the script that you need to run requires a newer version of the dependency than the installed package already provides, you can use the pip package manager to install it from a third-party source.
To ensure that your system remains supported, for each project you can install and run third-party packages in an isolated virtual environment created with the virtualenv and venv Python modules.
- Create a virtual environment named example2 for Python 2:
sudo dnf install python2-virtualenv
python2 -m virtualenv --system-site-packages example2
python3 -m venv --system-site-packages example3
source example3/bin/activate
python3 -m pip install --user requests
Attention: Using the pip2 and pip3 commands outside of a virtual environment will apply your changes system-wide, and that may impact compatibility with some installed packages in your Oracle Linux 8 installation. Add the —user flag to any pip install commands to ensure that dependency packages are only available to the current user.
Install package 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
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 additional packages that might be installed and prompts you to confirm whether to go ahead with the installation:
Last metadata expiration check: 1:30:59 ago on Mon 21 Feb 2022 16:58:56 GMT. Dependencies resolved. ========================================================================================================= Package Architecture Version Repository Size ========================================================================================================= Installing: kernel-devel x86_64 4.18.0-348.12.2.el8_5 ol8_baseos_latest 20 M Transaction Summary ========================================================================================================= Install 1 Package Total download size: 20 M Installed size: 51 M 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.
Related Topics
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 comprise 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 additional packages for enhanced functionality.
Modular content is made available separately to core OS packages so that these user-space applications can be installed in a variety of user-space environments, including virtual machines, containers as well as 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 multiple 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
Note: We recommend that you use the latest stream for any module that is installed, even though other streams might continue to receive limited support.
- 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 do not require additional 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 is 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 additional 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 of the underlying installed packages must satisfy all of the conditions that the packages declare. Likewise, all of the module stream dependencies must satisfied.
These additional constraints require that you analyze and understand the implications before performing any package operation. Changing the enabled module streams does not 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 additional modules.
- Installing a module stream profile or packages from a stream might also require the enabling of streams of additional modules and the installation of additional 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 additional 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 subsequently; thereby, mirroring the behavior of an unused yum repository.
- Switching the stream that is enabled for a module is the same as resetting the current stream and enabling a new stream.
Note: Switching an enabled stream does not 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, as well as the installation of packages in a new stream are all tasks that must be performed manually.
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 is 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 currently enabled stream of the module that provides this package and does not 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 is 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.
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.
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 .
sudo dnf module enable php:8.0 -y
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
How to Remove Installed Modules
Removing an installed module removes all of the packages and their dependencies that are installed by the profiles of the currently 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 are not 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 are prompted to confirm the action before proceeding.
sudo dnf module remove module-name
sudo dnf module disable module-name
How to Switch Module Streams
By switching module streams, you can obtain a different version of the current module that is 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 is different from the current version on the system.
In some of the steps, a summary of pending changes is first displayed and you are prompted to confirm the action before proceeding.
As an alternative, you can the dnf module switch-to command for this task. See Table 7-3.
sudo dnf module reset module-name
sudo dnf install @module-name:stream