How to install MongoDB in Fedora?

MongoDB is a cross-platform, source available, document database. It is classified as a No SQL database and uses JSON-like documents with dynamic schemas that means like a relational database it does not requires predefined schemas for entering data in the database.

MongoDB is developed by MongoDB Inc and licensed under the SSPL (Server Side Public License).

In this article, I will discuss how to install MongoDB in Fedora Linux.


You should have access to a user account that has superuser privileges.

Installing MongoDB in Fedora

Follow the given steps to install MongoDB in Fedora Linux.

Configure repository

To be able to install MongoDB using the dnf command you need to create a new configuration file with MongoDB yum repository.

Use the following command to create the configuration file –

sudo nano /etc/yum.repos.d/mongodb.repo

Add the following content to this file –

name=MongoDB Repository

As you can see in the image below.

mongodb yum configuration file
Save this file by pressing Ctrl+s and then exit from the editor by Ctrl+x.

Installing MongoDB

After creating the configuration file, run the update command –

sudo dnf update

Next, install the MongoDB by using –

sudo yum install -y mongodb-org

Start and enable MongoDB services

Once the installation of MongoDB is completed start its services by using the following command.

sudo systemctl start mongod.service

Enable the MongoDB services to start automatically when the system boots –

sudo systemctl enable mongod.service

Check MongoDB service status

Once the MongoDB services started you can check their status by using –

sudo systemctl status mongod

This will display output something like given in the image below.

mongod status

Check installed version of MongoDB

You can follow the given command to check the installed MongoDB version.

mongod --version

This will display the installed version of MongoDB on your system.

mongod version

Connect to MongoDB shell

Now everything has been set up correctly you can connect to the MongoDB shell by running the given command in your terminal –


Now you can start executing SQL queries in the given shell to create and manage databases.

mongodb shell


You have successfully installed MongoDB on your Fedora system. For more information, you can read the official MongoDB documentation.

For any other query write us in the comments below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version