21 C
Texas
angeloma
Senior Writer and partner

How install MongoDB on Fedora 34 / 33?

Currently, NoSQL Database managers are being widely used by developers. Since it has many advantages and their projects are the most open source. And MongoDB is one of the most popular managers. So, this article is about how to install MongoDB in Fedora 34 / 33.

MongoDB allows your teams to easily organize, use and enrich data – in real time, anywhere. MongoDB is a NoSQL and document-oriented database manager. In short, instead of saving the data in the record as the SQL database, it saves them in documents with BSON format which is a binary representation of JSON.

In the world of unrelated SQL database MongoDB is perhaps the most popular, however, it can be used by very different applications that require a semi-structured data collection. On the other hand, its use in transactional systems is not recommended as MongoDB does not support transactions.

That’s why I’m going to teach you how to install MongoDB on the latest stable versions of Fedora, Fedora 34 / 33.

Install MongoDB on Fedora 33

- Advertisement -

It is possible to install MongoDB on Fedora 34 / 33 through the RPM packages that can be downloaded and installed from the project’s website.

However, the most efficient method is to install from the official MongoDB repository which helps to integrate the application with the system.

So, for ease of use, install the nano text editor.

sudo dnf install nano

And edit a text file to add the MongoDB repository by adding the following content

sudo nano /etc/yum.repos.d/mongodb.repo
[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.asc
Configuring the MongoDB repository
Configuring the MongoDB repository

Save the changes and close the text editor.

Now you can install MongoDB on Fedora 34 / 33 by running

sudo dnf install mongodb-org

After installation, a new service is created for Fedora 34 / 33.

So, refresh the list of system daemons

sudo systemctl daemon-reload

Now start it up:

sudo systemctl start mongod

And then check the status of the service

sudo systemctl status mongod
● mongod.service - MongoDB Database Server
      Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
      Active: active (running) since Wed 2021-05-19 23:15:47 CEST; 5s ago
        Docs: https://docs.mongodb.org/manual
     Process: 2212 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
     Process: 2213 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
     Process: 2214 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
     Process: 2215 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)
    Main PID: 2217 (mongod)
      Memory: 57.6M
         CPU: 822ms
      CGroup: /system.slice/mongod.service
              └─2217 /usr/bin/mongod -f /etc/mongod.conf
 May 19 23:15:46 osradar systemd[1]: Starting MongoDB Database Server…
 May 19 23:15:46 osradar mongod[2215]: about to fork child process, waiting until server is ready for connections.
 May 19 23:15:46 osradar mongod[2217]: forked process: 2217
 May 19 23:15:47 osradar mongod[2215]: child process started successfully, parent exiting
 May 19 23:15:47 osradar systemd[1]: Started MongoDB Database Server.

Now check the version of MongoDB that you have installed

mongod -version
db 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"
     }
 }

So, enjoy it.

Conclusion

So, MongoDB is a solution that is increasingly being taken into account by many developers worldwide. Its installation in Fedora 34 / 33 is relatively simple.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article