Using CentOS Stream Module Streams to Run Multiple Nginx Versions Side‑by‑Side
Learn how CentOS Stream’s DNF module streams let you install and switch between different versions of the same application—like nginx 1.20 and nginx 1.22—without third‑party repos.
19 Jul 2025, 04:31 UTC

Problem: Needing different versions of the same stack on one host
Many teams run CentOS Stream as a base OS but still require multiple versions of a service—for example, nginx 1.20 for a legacy site and nginx 1.22 for a new feature branch. Traditionally this meant adding third‑party repositories, building custom RPMs, or using containers, each adding operational overhead.
Thesis: CentOS Stream’s DNF module streams let you pick a version stream from the default repositories and switch between them without external repos.
When a module stream is enabled, DNF resolves all dependencies within that stream, giving you a consistent set of libraries and automatic security updates for the chosen version.
How module streams work
Module metadata is stored in modulemd YAML files inside the repository. Each module (e.g., nginx) can expose several streams, each representing a release line. The default stream is used unless you explicitly enable another.
Key DNF commands:
dnf module list– shows all available modules and their streams.sudo dnf module enable name:stream– activates a non‑default stream.sudo dnf module reset name– disables the current stream, returning to the default.sudo dnf install package– installs the version from the enabled stream.
Worked example: installing nginx 1.22 on CentOS Stream 9
- Check what nginx streams are offered:
Expected output includes streams likednf module list nginxnginx:1.20(default) andnginx:1.22. - Enable the 1.22 stream:
DNF will enable the stream and adjust the repository metadata.sudo dnf module enable nginx:1.22 - Install nginx:
DNF pulls the 1.22 binary and any libraries declared in that stream.sudo dnf install nginx - Verify the version:
Should print something likenginx -vnginx version: nginx/1.22.0. - To switch back to the default stream, first remove the installed package (or keep it if you accept the risk), then reset:
This installs the default stream version (e.g., 1.20).sudo dnf module reset nginx sudo dnf install nginx
Trade‑off and limitation
Switching streams after packages are installed can break dependencies because the new stream may require different library versions. DNF will not automatically downgrade or upgrade existing packages; you typically need to run sudo dnf distro-sync or reinstall the affected packages to align with the new stream. Therefore, stream changes are safest on a fresh system or in a controlled maintenance window.
Not all software is modularized. Legacy packages that lack a modulemd file remain in the traditional RPM format and cannot be selected via streams; they continue to follow the default repository version.
Actionable closing
If you need to run multiple versions of a service on CentOS Stream, start by enumerating available streams with dnf module list. Enable the desired stream in a staging environment, install the package, and verify the version. Keep a record of which streams are enabled on each host (e.g., in Ansible or inventory) and test any stream switch with dnf distro-sync before applying to production. This approach lets you stay within the official repositories while gaining version flexibility.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.