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.
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 –
[mongodb-org-4.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/4.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.4.as
As you can see in the image below.
Save this file by pressing
Ctrl+s and then exit from the editor by
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.
Check installed version of MongoDB
You can follow the given command to check the installed MongoDB version.
This will display the installed version of MongoDB on your system.
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.
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.