Managing AlmaLinux 9 DNF Module Streams for RHEL‑Compatible Workloads
Learn how to enable, disable, and verify DNF module streams on AlmaLinux 9 to keep your environment RHEL‑compatible. The guide covers prerequisites, step‑by‑step commands, checks, and recovery options.
04 Dec 2025, 11:02 UTC

Desired Outcome
Configure AlmaLinux 9 to use a specific DNF module stream (e.g., nodejs:16) while preserving binary compatibility with Red Hat Enterprise Linux (RHEL) and maintaining system stability.
Prerequisites
- AlmaLinux 9 installed with a working network connection.
- Root or
sudoprivileges. - Verified AlmaLinux GPG key in
/etc/pki/rpm-gpg(fingerprint4A0A0E2F…). - Knowledge of the module you wish to enable (stream name and version).
Step‑by‑Step Procedure
List Available Module Streams
Run
dnf module listto see all modules and their available streams. This command lists the current status (enabled, disabled, or disabled by default) and the default stream for each module.sudo dnf module listCheck the output for the module of interest. For example,
nodejswill show streams14,16, and18. The default stream is usually the one marked with an asterisk.Enable the Desired Stream
To switch to a non‑default stream, use
dnf module enable. ReplaceMODULEandSTREAMwith the actual names.sudo dnf module enable MODULE:STREAMExample: enable Node.js 16.
sudo dnf module enable nodejs:16DNF will resolve dependencies and may suggest disabling conflicting modules. Confirm the changes when prompted.
Disable Competing Modules (If Needed)
Some modules may conflict with the stream you enabled. Use
dnf module resetto clear the current selection and then enable the desired stream again.sudo dnf module reset nodejs sudo dnf module enable nodejs:16Install Packages from the Enabled Stream
After enabling, install the package you need. DNF automatically pulls the correct runtime from the stream.
sudo dnf install nodejsVerify the installed version:
node -vVerify RHEL Binary Compatibility
AlmaLinux 9 is binary‑compatible with RHEL 9. To confirm, install a package that is binary identical to RHEL’s build and run a simple test. For example, install
openssland compare its version string.sudo dnf install openssl openssl versionCompare the output with a RHEL 9 system. Matching major/minor numbers and build identifiers confirm compatibility.
Check SELinux Mode
AlmaLinux defaults to targeted mode. Verify with
sestatus:sestatusEnsure
SELinux status: enabledandCurrent mode: targetedare displayed.Enable Kernel Live Patching (Optional)
Zero‑downtime kernel updates can be enabled via the
kpatchservice. First, install the package:sudo dnf install kpatchThen start and enable the service:
sudo systemctl enable --now kpatchVerify with:
sudo systemctl status kpatch
Expected Checks
- Module Stream Status:
dnf module list nodejsshould shownodejs:16as enabled. - Package Version:
node -vshould outputv16.x.x. - SELinux Mode:
sestatusmust reporttargeted. - GPG Key: Inspect
/etc/yum.repos.d/*.repofor the AlmaLinux key fingerprint4A0A0E2F…. - Kernel Patching (if enabled):
kpatch statusshould list active patches.
Recovery Options
- Module Conflict: If a conflict arises, reset the module and re‑enable the desired stream:
sudo dnf module reset nodejs sudo dnf module enable nodejs:16 - Revert to Default Stream:
sudo dnf module reset nodejs sudo dnf module enable nodejs:default - Undo Live Patching:
sudo systemctl stop kpatch sudo dnf remove kpatch
Limitations and Practical Checks
- DNF module streams are subject to change in future AlmaLinux releases; always review
dnf module listbefore major upgrades. - Manually installed packages from
/usr/localorrpmmay override module selections. Avoid mixing module‑managed and manually installed runtimes. - SELinux policies can be overridden by custom rules; audit with
audit2allowif unexpected denials occur. - Kernel live patching requires Red Hat subscription for the latest patches; AlmaLinux mirrors the same patches but may lag slightly.
Concrete Example: Switching Node.js to Version 16
Assume you have an existing Node.js 14 installation that you need to upgrade to the RHEL‑compatible Node.js 16 stream.
sudo dnf module list nodejsOutput shows
nodejs:14enabled,nodejs:16available.sudo dnf module reset nodejs sudo dnf module enable nodejs:16sudo dnf install nodejsnode -vShould display
v16.x.x.
Verify that the binary is identical to RHEL 9 by comparing the node binary checksum with a known RHEL build. If the checksums match, binary compatibility is confirmed.
Conclusion
By following this guide, you can confidently manage DNF module streams on AlmaLinux 9, ensuring your applications run the correct runtime version while maintaining RHEL binary compatibility, SELinux security posture, and optional kernel live patching.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.