How to install and configure MongoDB on Fedora 34

To Install And Configure MongoDB On Fedora 34.

Introduction:

MongoDB is an open-source NoSQL database management system that stores, retrieves, and manages document-oriented information.

Installation Procedure:

Step 1: Check the installed OS version by using the below command.

[root@linuxhelp ~]# cat /etc/os-release
NAME=Fedora
VERSION="34 (Workstation Edition)"
ID=fedora
VERSION_ID=34
VERSION_CODENAME=""
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:34"
HOME_URL="https://fedoraproject.org/"
VARIANT="Workstation Edition"
VARIANT_ID=workstation

Step 2: Add the MongoDB repository key to add repository by using the below command.

[root@linuxhelp ~]# vim /etc/yum.repos.d/mongodb.repo
[Mongodb]
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.asc

Step 3: Install the MongoDB by using the below command.

[root@linuxhelp ~]# dnf install mongodb-org mongodb-org-server
MongoDB Repository                                                             43 kB/s |  32 kB     00:00    
Last metadata expiration check: 0:00:01 ago on Wed 15 Dec 2021 06:54:21 AM IST.
Dependencies resolved.

 Problem: package mongodb-org-4.4.10-1.el8.x86_64 requires mongodb-org-tools = 4.4.10, but none of the providers can be installed
  - package mongodb-org-tools-4.4.10-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.10, but none of the providers can be installed
  - cannot install the best candidate for the job
  - nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.10-1.el8.x86_64
==============================================================================================================
 Package                                   Architecture    Version                     Repository        Size
==============================================================================================================
Installing:
 mongodb-org                               x86_64          4.4.4-1.el8                 Mongodb           10 k
Installing dependencies:
 annobin                                   x86_64          9.79-2.fc34                 updates          133 k
 dwz                                       x86_64          0.14-1.fc34                 fedora           129 k
 efi-srpm-macros                           noarch          5-4.fc34                    updates           22 k

Transaction Summary


==============================================================================================================
Install  30 Packages
Skip      3 Packages

Total download size: 131 M
Installed size: 379 M
Is this ok [y/N]: y
Downloading Packages:
(1/30): go-srpm-macros-3.0.10-1.fc34.noarch.rpm                                74 kB/s |  25 kB     00:00    
(2/30): efi-srpm-macros-5-4.fc34.noarch.rpm                                    60 kB/s |  22 kB     00:00    
(3/30): python-srpm-macros-3.9-41.fc34.noarch.rpm                             116 kB/s |  21 kB     00:00    
  Running scriptlet: mongodb-database-tools-100.5.1-1.x86_64                                             4/30 
  Installing       : mongodb-database-tools-100.5.1-1.x86_64                                             4/30 
  Running scriptlet: mongodb-database-tools-100.5.1-1.x86_64                                             4/30 
  Installing       : mongodb-org-database-tools-extra-4.4.4-1.el8.x86_64                                 5/30 
  Installing       : mongodb-org-tools-4.4.4-1.el8.x86_64                                                6/30 
  Installing       : mongodb-org-shell-4.4.4-1.el8.x86_64                                                7/30 

Installed:
  annobin-9.79-2.fc34.x86_64                                  dwz-0.14-1.fc34.x86_64                         
  efi-srpm-macros-5-4.fc34.noarch                             fonts-srpm-macros-1:2.0.5-5.fc34.noarch        
Skipped:
  mongodb-org-4.4.10-1.el8.x86_64                mongodb-org-database-tools-extra-4.4.10-1.el8.x86_64         
  mongodb-org-tools-4.4.10-1.el8.x86_64         

Complete!

Step 4: Enable the MongoDB service by using the below command.

 [root@linuxhelp ~]# systemctl enable mongod.service

Step 5: Start the MongoDB service by using the below command.

[root@linuxhelp ~]# systemctl start mongod.service

Step 6: Check the status of MongoDB service by using the below command.

[root@linuxhelp ~]# systemctl status mongod.service
● mongod.service - MongoDB Database Server
     Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2021-12-15 06:58:02 IST; 22s ago
       Docs: https://docs.mongodb.org/manual
    Process: 52398 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
    Process: 52399 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
    Process: 52400 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
    Process: 52401 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 52403 (mongod)
     Memory: 57.5M
        CPU: 967ms
     CGroup: /system.slice/mongod.service
             └─52403 /usr/bin/mongod -f /etc/mongod.conf

Dec 15 06:58:01 linuxhelp systemd[1]: Starting MongoDB Database Server...
Dec 15 06:58:01 linuxhelp mongod[52401]: about to fork child process, waiting until server is ready for conne>
Dec 15 06:58:01 linuxhelp mongod[52403]: forked process: 52403
Dec 15 06:58:02 linuxhelp mongod[52401]: child process started successfully, parent exiting


Dec 15 06:58:02 linuxhelp systemd[1]: Started MongoDB Database Server.
lines 1-19/19 (END)

Step 7: Check the status of MongoDB service by using the below command.

[root@linuxhelp ~]# mongo --version
MongoDB shell version v4.4.4
Build Info: {
    "version": "4.4.4",
    "gitVersion": "8db30a63db1a9d84bdcad0c83369623f708e0397",
    "openSSLVersion": "OpenSSL 1.1.1k  FIPS 25 Mar 2021",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "rhel80",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

With this, process of installing and configure MongoDB on Fedora 34 comes to an end

FAQ
Q
What do you mean by a NoSQL database?
A
A NoSQL refers to a non SQL or non-relational database that provides a mechanism for storage and retrieval of data.
Q
How NoSQL database stores the data?
A
NoSQL databases stores information
in JSON documents instead of columns and rows used by relational databases
Q
Differentiate SQL and NoSQL?
A
SQL databases are relational, NoSQL databases are non-relational
Q
What is Non Relational database?
A
A non-relational database is any database that is not like relational databases.
Rather, its storage model is customized for the type of data it’s storing.
Q
What is a Relational database?
A
Relational databases store data in rows and columns like a spreadsheet