×


Install MongoDB on Fedora 35 - Step by step guide ?

MongoDB is a free and open-source document database designed for ease of application development and scaling. It is classified as a NoSQL database and thus it stores data in flexible, JSON-like documents, meaning fields can vary from document to document and data structure can be changed over time.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related MongoDB queries.

In this context, we shall look into how to install MongoDB on Fedora 35.


Main Features of MongoDB:

  • MongoDB provides high performance to data persistence.
  • MongoDB has rich query language.
  • MongoDB's replication facility called replica set provides automatic failover and data redundancy increasing data high availability.
  • MongoDB supports horizontal scalability.
  • MongoDB supports multiple storage engines.


Steps to Install MongoDB on Fedora 35

1. Perform System Update

First, you will need to update your Fedora operating system to make sure all existing packages are up to date. You can use this command to update the server packages:

$ sudo dnf upgrade
$ sudo dnf update


2. Install MongoDB on your system

By default, MongoDB is available on Fedora 35 base repository. Now run the following command below to add MongoDB repository on Fedora system:

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

Add the below files:

[mongodb-upstream]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

After that, update packages and install the latest stable version of MongoDB using the following command:

$ sudo dnf update
$ sudo dnf install mongodb-org

Once installation is complete we need to start the MongoDB server to start operating. We do that with the following command below:

$ sudo systemctl start mongod
$ sudo systemctl enable mongod

You can check the version of MongoDB installed using the following command:

$ mongod --version

Output:

db version v4.4.4
Build Info: {
    "version": "4.4.4",
    "gitVersion": "8db30abmwe469d84bdcad0c83369623f100120397",
    "openSSLVersion": "OpenSSL 1.1.1l  FIPS 24 Aug 2021",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "rhel80",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}


3. Configure Firewall

We need to enable the firewall in order to filter traffic into our server. Now we allow port 27017/TCP in the firewall using the following command:

$ sudo firewall-cmd --add-port=27017/tcp --permanent
$ sudo firewall-cmd --reload


How to access MongoDB on Fedora ?

Now we run the following command to connect to the mongo shell:

$ mongo

Output:

MongoDB shell version v4.4.4
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("Me7b4c9a0-9243-e463-336-920737aG4pa7c") }
MongoDB server version: 4.4.4
Welcome to the MongoDB shell.
For interactive help, type "help".
---


How To Uninstall mongodb on Ubuntu 20.04 ?

To uninstall only the mongodb package we can use the following command:

$ sudo apt-get remove mongodb


[Need help in configuring MongoDB on your Linux system ? We can help you. ]


Conclusion

This article covers how to install the MongoDB database on your Fedora 35 system. In fact, MongoDB stores documents in collection. Collections are analogous to tables in relational databases. Every record in a mongoDB document, which is a data structure composed of field and pair values.


How to Run MongoDB Community Edition on Fedora ?

1. We can start MongoDB service using this command:

$ sudo systemctl start mongod

2. You can verify that the mongod process has started successfully by issuing the following command:

$ sudo systemctl status mongod

3. To make MongoDB start automatically when the system reboot, enter this command:

$ sudo systemctl enable mongod

Once we verify that our mongod process has started successfully, we can connect to MongoDB server. MongoDB provide an utility (shell) to interact with its database called mongosh.

4. To start a mongosh session on the same host machine as the MongoDB server (mongod), you can run mongosh without any command-line options:

$ mongosh