• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Saturday, June 14, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Install MongoDB on Rocky Linux

in Linux OS, Red Hat Enterprise Linux, Rocky Linux
How to Install MongoDB on Rocky Linux

MongoDB is an open-source, document-oriented NoSQL database that offers high performance, availability, and scalability. This tutorial will guide you through the process of how to install MongoDB on Rocky Linux. It’s perfect for developers looking for a powerful, flexible, and easy-to-use database solution.

Prerequisites

Before we begin, ensure that you have:

  • A Rocky Linux system up and running
  • Root or sudo user access

How to Install MongoDB on Rocky Linux

Configure MongoDB Repository

First, let’s create a new repository file for MongoDB by issuing the following command:

sudo nano /etc/yum.repos.d/mongodb-org.repo

Paste the following content into the newly created file:

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

Save and exit the file by pressing Ctrl + X, followed by Y, then Enter.

Install MongoDB on Rocky Linux

With the repository configured, we can now proceed to install MongoDB by running:

sudo dnf install -y mongodb-org
Install MongoDB on Rocky Linux

This command installs the latest stable version of MongoDB along with its necessary tools.

Start and Enable MongoDB Service on Rocky Linux

Once the installation is complete, start the MongoDB service using:

sudo systemctl start mongod

To enable the MongoDB service to start automatically on boot, run:

sudo systemctl enable mongod

You can check the status of the MongoDB service with:

sudo systemctl status mongod

Configure MongoDB on Rocky Linux (Optional)

The default configuration file for MongoDB is located at /etc/mongod.conf. You can edit this file to adjust settings like storage, systemLog, and more. For example, if you want to change the default listening IP address or port number, edit the net section:

net:
  port: NEW_PORT_NUMBER
  bindIp: NEW_IP_ADDRESS

Save your changes and restart the MongoDB service to apply them:

sudo systemctl restart mongod

Test MongoDB Installation on Rocky Linux

To verify that your MongoDB installation is working correctly, connect to the MongoDB shell by running:

mongo

This command should open the MongoDB shell, where you can execute various MongoDB commands. Try creating a new database, inserting a document, and then retrieving it:

use myNewDatabase
db.myNewCollection.insert({ name: "LinuxBoost", description: "A great resource for Linux enthusiasts" })
db.myNewCollection.find()

If the inserted document is returned, your MongoDB installation is functioning correctly.

Conclusion

Congratulations! You’ve successfully installed MongoDB on Rocky Linux. You can now start building powerful applications using this robust and flexible database system. For more information on using MongoDB, refer to the official MongoDB documentation.

If you’re interested in learning more about other Linux topics, check out some of our other tutorials:

  • How to Install and Configure Lighttpd on Rocky Linux
  • How to Install and Configure Grafana on Arch Linux
ShareTweet
Previous Post

How to Install and Configure Lighttpd on Rocky Linux

Next Post

How to Install and configure ProFTPD on Rocky Linux

Related Posts

How to Install and Configure OpenVAS on Rocky Linux

How to Install and Configure OpenVAS on Rocky Linux

How to Install and Configure Nikto on Rocky Linux

How to Install and Configure Nikto on Rocky Linux

Set up FreeIPA on Rocky Linux

How to Install and Configure FreeIPA on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.