How to Install MongoDB in RHEL
MongoDB is a popular NoSQL document-oriented database that is known for its high performance, scalability, and flexibility. It was first released in 2009 by the MongoDB company and has since become a widely-used database among developers and enterprises.
MongoDB’s open-source nature makes it a great choice for almost any database project. Its popularity stems from its embrace of NoSQL, document-oriented databases.
Unlike traditional relational databases that rely on tables and rows, MongoDB uses JSON-like documents, which also allow for dynamic schemas. This flexibility sets it apart.
With its scalability and developer-friendly features, MongoDB is a solid option to install on RHEL 8-based systems.
MongoDB offers two versions of its database server: the MongoDB Enterprise Server and the open-source MongoDB Community Server.
Installing MongoDB in RHEL-based Linux
We are going to focus on the installation and configuration of MongoDB Community Server.
# dnf update
Next, we need to add MongoDB GPG Key and Repository Entry to the system in order to install the latest version of MongoDB.
# vim /etc/yum.repos.d/mongodb-org-8.0.repo
[mongodb-org-8.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/9/mongodb-org/8.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://pgp.mongodb.com/server-8.0.asc
We now need to run a system update for the second time for this new repository entry to be recognized.
# dnf update
We can now accomplish the installation of the MongoDB database server.
# dnf install mongodb-org

To start the service responsible for running MongoDB
# systemctl start mongod.service
# systemctl enable mongod
# systemctl status mongod.service