Installing alternative versions of RPMs in Fedora

Modularity enables Fedora to provide alternative versions of RPM packages in the repositories. Several different applications, language runtimes, and tools are available in multiple versions, build natively for each Fedora release. 

The Fedora Magazine has already covered Modularity in Fedora 28 Server Edition about a year ago. Back then, it was just an optional repository with additional content, and as the title hints, only available to the Server Edition. A lot has changed since then, and now Modularity is a core part of the Fedora distribution. And some packages have moved to modules completely. At the time of writing — out of the 49,464 binary RPM packages in Fedora 30 — 1,119 (2.26%) come from a module (more about the numbers).

Modularity basics

Because having too many packages in multiple versions could feel overwhelming (and hard to manage), packages are grouped into modules that represent an application, a language runtime, or any other sensible group.

Modules often come in multiple streams — usually representing a major version of the software. Available in parallel, but only one stream of each module can be installed on a given system.

And not to overwhelm users with too many choices, each Fedora release comes with a set of defaults — so decisions only need to be made when desired.

Finally, to simplify installation, modules can be optionally installed using pre-defined profiles based on a use case. A database module, for example, could be installed as a client, a server, or both.

Modularity in practice

When you install an RPM package on your Fedora system, chances are it comes from a module stream. The reason why you might not have noticed is one of the core principles of Modularity — remaining invisible until there is a reason to know about it.

Let’s compare the following two situations. First, installing the popular i3 tiling window manager, and second, installing the minimalist dwm window manager:

$ sudo dnf install i3
...
Done!

As expected, the above command installs the i3 package and its dependencies on the system. Nothing else happened here. But what about the other one?

$ sudo dnf install dwm
...
Enabling module streams:
dwm 6.1
...
Done!

It feels the same, but something happened in the background — the default dwm module stream (6.1) got enabled, and the dwm package from the module got installed.

To be transparent, there is a message about the module auto-enablement in the output. But other than that, the user doesn’t need to know anything about Modularity in order to use their system the way they always did.

But what if they do? Let’s see how a different version of dwm could have been installed instead.

Use the following command to see what module streams are available:

$ sudo dnf module list
...
dwm latest ...
dwm 6.0 ...
dwm 6.1 [d] ...
dwm 6.2 ...
...
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

The output shows there are four streams of the dwm module, 6.1 being the default.

To install the dwm package in a different version — from the 6.2 stream for example — enable the stream and then install the package by using the two following commands:

$ sudo dnf module enable dwm:6.2
...
Enabling module streams:
dwm 6.2
...
Done!
$ sudo dnf install dwm
...
Done!

Finally, let’s have a look at profiles, with PostgreSQL as an example.

$ sudo dnf module list
...
postgresql 9.6 client, server ...
postgresql 10 client, server ...
postgresql 11 client, server ...
...

To install PostgreSQL 11 as a server, use the following command:

$ sudo dnf module install postgresql:11/server

Note that — apart from enabling — modules can be installed with a single command when a profile is specified.

It is possible to install multiple profiles at once. To add the client tools, use the following command:

$ sudo dnf module install postgresql:11/client

There are many other modules with multiple streams available to choose from. At the time of writing, there were 83 module streams in Fedora 30. That includes two versions of MariaDB, three versions of Node.js, two versions of Ruby, and many more.

Please refer to the official user documentation for Modularity for a complete set of commands including switching from one stream to another.

Fedora Project community

10 Comments

  1. A handy shorthand for installing multiple profiles at the same time is

    sudo dnf module install postgresql:11/{server,client}
  2. Jens Petersen

    I clicked on this, thinking we had a module for the rpm package now… 😉

    I think it would be clearer to include the word “package/s” in the title. 🙂

  3. Walter

    Hi Adam,

    I’m on Fedora Rawhide (5.2.0-0.rc3.git0.1.fc31.x86_64) and from the very beginning I ran into this problem:

    Whenever I do a dnf update I get

    ————snip 1
    Last metadata expiration check: 0:45:12 ago on Thu 13 Jun 2019 06:40:13 AM CEST.
    Modular dependency problem:

    Problem: module libgit2:0.28:3120190606170438:f636be4b-0.x86_64 conflicts with module(libgit2:0.27) provided by libgit2:0.27:31201904
    07181414:f636be4b-0.x86_64
     – module libgit2:0.27:3120190407181414:f636be4b-0.x86_64 conflicts with module(libgit2:0.28) provided by libgit2:0.28:31201906061704
    38:f636be4b-0.x86_64
     – module tokei:rolling:3120190424130518:c3f9a127-0.x86_64 requires module(libgit2:0.27), but none of the providers can be installed
     – conflicting requests
    Dependencies resolved.
    —————–snap 1

    A module list shows up with

    ———- snip 2

    dnf module list libgit2

    Last metadata expiration check: 0:35:08 ago on Thu 13 Jun 2019 06:40:13 AM CEST.
    Modular dependency problem:

    Problem: module libgit2:0.28:3120190606170438:f636be4b-0.x86_64 conflicts with module(libgit2:0.27) provided by libgit2:0.27:3120190407181414:f636be4b-0.x86_64
    – module libgit2:0.27:3120190407181414:f636be4b-0.x86_64 conflicts with module(libgit2:0.28) provided by libgit2:0.28:3120190606170438:f636be4b-0.x86_64
    – module tokei:rolling:3120190424130518:c3f9a127-0.x86_64 requires module(libgit2:0.27), but none of the providers can be installed
    – conflicting requests
    Fedora – Modular Rawhide – Developmental packages for the next Fedora release
    Name Stream Profiles Summary
    libgit2 0.26 Library implementation of Git
    libgit2 0.27 Library implementation of Git
    libgit2 0.28 [d][e] Library implementation of Git
    ——————– snap 2

    I tried different things like making 0.27 default/enabled – but no luck!
    The problem remains the same.

    What can I do in order to solve this issue?

    Thanks for your time! 🙂

  4. alfC

    Can this be used to install older version of gcc side-by-side? I need gcc 8 (in place of gcc 9) to compile with Nvidia’s nvcc.

  5. Danny Arcarius Mexen

    Thank you very much for this. I recently switched to Fedora so I am still learning and exploring.
    This was a wonderful article and I learned something new.

  6. FeRD (Frank Dana)

    OOC, if you already have postgresql:11/server installed, do you have to specify the entire ‘postgresql:11/client’ selector, to install the client? Seems like one of ‘postgresql/client’ or ‘postgresql:client’ should be sufficient (not sure how the syntax is parsed exactly), since if I’m reading correctly 11 is the only client version option if 11/server is already installed, right?

  7. So, really, every item and fixture considered, the Yankees
    have a better left fielder ok. Yes, I consider films for a great art form, after i do prose and poetry. http://transmobile.ru/bitrix/rk.php?goto=http%3A%2F%2F918.cafe%2Fdownloads%2F61-download-918kiss-scr888-ios-android

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions