(Last Updated On: November 3, 2018)

Fedora 29/28 comes with Modularity Repository feature that allows you to install additional versions of software on independent life cycles through the Application Stream also referred to as AppStream. This enables you to keep your operating system up-to-date while having the right version of an application that suits your use case.

The dnf subcommandmodule is used to manage Modular Repository on a Fedora system which supports the feature. See below examples on how to use Fedora Modular Repository.

List Available Modules

To list all module streams, their profiles, and states (enabled, disabled, default), run the commands:

# dnf module list

You’ll get an output similar to one below:

Fedora Modular 29 - x86_64
Name               Stream           Profiles                                          Summary                                                         
ant                1.10             default [d]                                       Java build tool                                                 
avocado            latest           minimal, default                                  Framework with tools and libraries for Automated Testing        
avocado            stable           minimal, default                                  Framework with tools and libraries for Automated Testing        
container-tools    2017.0           default                                           Common tools and dependencies for container runtimes            
container-tools    2018.0           default                                           Common tools and dependencies for container runtimes            
cri-o              1.11             default                                           Kubernetes Container Runtime Interface for OCI-based containers 
cri-o              2017.0           default                                           Kubernetes Container Runtime Interface for OCI-based containers 
cri-o              2018.0           default                                           Kubernetes Container Runtime Interface for OCI-based containers 
django             1.6              python2_development, default [d]                  A high-level Python Web framework                               
docker             2017.0           default                                           Module for docker runtime and docker-distribution               
dwm                6.0              user, default [d]                                 Dynamic window manager for X                                    
dwm                6.1 [d]          user, default [d]                                 Dynamic window manager for X                                    
dwm                latest           user, default [d]                                 Dynamic window manager for X                                    
eog                master           default                                           Eye of GNOME Application Module                                 
flatpak-runtime    f29              sdk-base, buildroot, sdk, runtime, runtime-base   Flatpak Runtime                                                 
gcsf               master           default                                           FUSE file system based on Google Drive                          
gimp               2.10             devel, default                                    GIMP                                                            
golang             1.10             default                                           The Go Programming Language                                     
golang-ecosystem   2017.0           default                                           The ecosystem of packages for the Go programming language       
golang-ecosystem   2018.0           default                                           The ecosystem of packages for the Go programming language       
hub                pre-release      default                                           A command-line wrapper for git with github shortcuts            
kubernetes         1.10             default                                           Container cluster management                                    
kubernetes         openshift-3.10   default                                           OpenShift Container Management                                  
libgit2            0.26                                                               Library implementation of Git                                   
libgit2            0.27                                                               Library implementation of Git                                   
lizardfs           devel                                                              Distributed, fault tolerant file system                         
mariadb            10.1             client, server, default                           MariaDB Module                                                  
maven              3.5              default [d]                                       Java project management and project comprehension tool          
meson              master           default                                           The Meson Build system                                          
mongodb            3.4              client, server, default                           MongoDB Module                                                  
mongodb            3.6              client, server, default                           MongoDB Module                                                  
mysql              5.7              client, server, default                           MySQL Module                                                    
ninja              master           default                                           Small build system with a focus on speed                        
nodejs             10               development, minimal, default                     Javascript runtime                                              
nodejs             8                development, minimal, default [d]                 Javascript runtime                                              
perl               5.24             minimal, default                                  Practical Extraction and Report Language                        
perl               5.26             minimal, default                                  Practical Extraction and Report Language                        
perl-bootstrap     5.24                                                               Perl bootstrap module for bootrapping Perl module               
perl-bootstrap     5.26                                                               Perl bootstrap module for bootrapping Perl module               
pki                10.6             default                                           Dogtag PKI                                                      
postgresql         9.6              client, server, default                           PostgreSQL module                                               
reviewboard        2.5              server, default [d]                               A web-based code review tool                                    
reviewboard        3.0              server, default [d]                               A web-based code review tool                                    
ripgrep            master           default                                           Line oriented search tool using Rust's regex library            
scala              2.10             default                                           A hybrid functional/object-oriented language for the JVM        
stratis            1 [d]            default [d]                                       Stratis Storage                                                 
stratis            master           default                                           Stratis Storage                                                 
testmodule         master           default                                           A test module in all its beautiful beauty          
........

To display information about a specific module, provide the name as an argument to the previous command:

# dnf module list kubernetes
Last metadata expiration check: 0:33:58 ago on Sat 03 Nov 2018 02:02:06 PM UTC.
Fedora Modular 29 - x86_64
Name                             Stream                              Profiles                      Summary                                            
kubernetes                       1.10                                default                       Container cluster management                       
kubernetes                       openshift-3.10                      default                       OpenShift Container Management                     

Fedora Modular 29 - x86_64 - Updates
Name                             Stream                              Profiles                      Summary                                            
kubernetes                       1.10                                default                       Container cluster management                       
kubernetes                       openshift-3.10                      default                       OpenShift Container Management                     

Hint: [d]efault [e]nabled, [x]disabled, [i]nstalled

Install module profiles

The syntax for installing a module is:

# dnf [options] module install <module_spec>...

First get a module stream, e.g:

# dnf module list mongodb
Last metadata expiration check: 0:39:49 ago on Sat 03 Nov 2018 02:02:06 PM UTC.
Fedora Modular 29 - x86_64
Name                             Stream                         Profiles                                        Summary                               
mongodb                          3.4                            client, server, default                         MongoDB Module                        
mongodb                          3.6                            client, server, default                         MongoDB Module                        

Fedora Modular 29 - x86_64 - Updates
Name                             Stream                         Profiles                                        Summary                               
mongodb                          3.4                            client, server, default                         MongoDB Module                        
mongodb                          3.6                            client, server, default                         MongoDB Module

You can see that modulemongodb has two streams, one for MongoDB 3.4, and another for 3.6. To install MongoDB,3.6 run:

# dnf module install mongodb:3.6/default 
Last metadata expiration check: 0:42:02 ago on Sat 03 Nov 2018 02:02:06 PM UTC.
Dependencies resolved.
======================================================================================================================================================
 Package                                Arch                    Version                                         Repository                       Size
======================================================================================================================================================
Installing group/module packages:
 mongodb                                x86_64                  3.6.4-2.module_1831+e8c1cdcd                    fedora-modular                   26 M
 mongodb-server                         x86_64                  3.6.4-2.module_1831+e8c1cdcd                    fedora-modular                   22 M
Installing dependencies:
 boost-filesystem                       x86_64                  1.66.0-14.fc29                                  fedora                           52 k
 boost-iostreams                        x86_64                  1.66.0-14.fc29                                  fedora                           43 k
 boost-program-options                  x86_64                  1.66.0-14.fc29                                  fedora                          145 k
 boost-system                           x86_64                  1.66.0-14.fc29                                  fedora                           22 k
 gperftools-libs                        x86_64                  2.7-3.fc29                                      fedora                          304 k
 libstemmer                             x86_64                  0-11.585svn.fc29                                fedora                           72 k
 libunwind                              x86_64                  1.2.1-6.fc29                                    fedora                           61 k
 pcre-cpp                               x86_64                  8.42-4.fc29                                     fedora                           27 k
 snappy                                 x86_64                  1.1.7-6.fc29                                    fedora                           33 k
 yaml-cpp                               x86_64                  0.6.1-4.fc29                                    fedora                          163 k
Installing module profiles:
 mongodb/default                                                                                                                                     
Enabling module streams:
 mongodb                                                        3.6                                                                                  

Transaction Summary
======================================================================================================================================================
Install  12 Packages

Total download size: 48 M
Installed size: 146 M
Is this ok [y/N]: y

Confirm installation by typing y. After installation, you can confirm package version with commandrpm.

# rpm -qi mongodb-server
Name        : mongodb-server
Version     : 3.6.4
Release     : 2.module_1831+e8c1cdcd
Architecture: x86_64
Install Date: Sat 03 Nov 2018 02:46:49 PM UTC
Group       : Applications/Databases
Size        : 69489417
License     : AGPLv3 and zlib and ASL 2.0
Signature   : RSA/SHA256, Fri 01 Jun 2018 03:01:17 PM UTC, Key ID a20aa56b429476b4
Source RPM  : mongodb-3.6.4-2.module_1831+e8c1cdcd.src.rpm
Build Date  : Fri 01 Jun 2018 10:41:49 AM UTC
Build Host  : buildvm-21.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://www.mongodb.org
Bug URL     : https://bugz.fedoraproject.org/mongodb
Summary     : MongoDB server, sharding server and support scripts
Description :
This package provides the mongo server software, mongo sharding server
software, default configuration files, and init scripts.

To downgrade to MongoDB 3.4, you’ll install the 3.4 module

#  dnf module install mongodb:3.4/default 
Last metadata expiration check: 0:52:06 ago on Sat 03 Nov 2018 02:02:06 PM UTC.
Dependencies resolved.
======================================================================================================================================================
 Package                           Arch                      Version                                          Repository                         Size
======================================================================================================================================================
Installing dependencies:
 boost-chrono                      x86_64                    1.66.0-14.fc29                                   fedora                             27 k
 boost-regex                       x86_64                    1.66.0-14.fc29                                   fedora                            286 k
 boost-thread                      x86_64                    1.66.0-14.fc29                                   fedora                             62 k
Downgrading:
 mongodb                           x86_64                    3.4.11-3.module_1829+95924ba0                    fedora-modular                     23 M
 mongodb-server                    x86_64                    3.4.11-3.module_1829+95924ba0                    fedora-modular                     20 M
Switching module streams:
 mongodb                                                     3.6 -> 3.4                                                                              

Transaction Summary
======================================================================================================================================================
Install    3 Packages
Downgrade  2 Packages

Total download size: 43 M
Is this ok [y/N]: y

You should see pointer3.6 -> 3.4 indicating it is a downgrade.

Enable a module stream

If you have a different version that was installed through other external repositories, uninstall it first, then enable module

sudo dnf remove mongodb-server
sudo dnf module enable mongodb:3.6

This will enable a module stream and make the stream RPMs available in the package set. Modular dependencies are resolved and checked at the enablement time but do not get enabled automatically. The enable command can also be used for switching module streams

Enable a module stream

To disable a module and make all related module streams unavailable, use:

$ dnf module disable <module-name>

List enabled module streams

To list module streams that are enabled, execute

# dnf module list --enabled 
Last metadata expiration check: 1:05:33 ago on Sat 03 Nov 2018 02:02:06 PM UTC.
Fedora Modular 29 - x86_64
Name                           Stream                         Profiles                                           Summary                              
mongodb                        3.6 [e]                        client, server, default [i]                        MongoDB Module                       

Fedora Modular 29 - x86_64 - Updates
Name                           Stream                         Profiles                                           Summary                              
mongodb                        3.6 [e]                        client, server, default [i]                        MongoDB Module                       

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Get module stream detailed information

The syntax for printing a  detailed information about given module stream is:

# dnf module info <module_spec>

Example:

# dnf  module info mongodb:3.6

Reset module state

You can also reset module state so it’s no longer enabled or disabled.

# dnf module reset <module_spec>

Example:

# dnf module reset mongodb:3.6
Last metadata expiration check: 1:11:26 ago on Sat 03 Nov 2018 02:02:06 PM UTC.
Dependencies resolved.
======================================================================================================================================================
 Package                             Arch                               Version                             Repository                           Size
======================================================================================================================================================
Removing module profiles:
 mongodb/default                                                                                                                                     
Resetting module streams:
 mongodb                                                                3.6                                                                          

Transaction Summary
======================================================================================================================================================

Is this ok [y/N]: y
Complete!