How to install and configure MongoDB database on CentOS?

You can install and configure MongoDB database in CentOS by following these steps:

  1. Open the terminal and use the following command to install the official repository for MongoDB.
sudo yum install -y https://repo.mongodb.org/yum/redhat/mongodb-org/4.4/x86_64/RPMS/mongodb-org-server-4.4.10-1.el7.x86_64.rpm
  1. Install the MongoDB database service:
sudo yum install -y mongodb-org
  1. Start MongoDB service and set it to start automatically on boot.
sudo systemctl start mongod
sudo systemctl enable mongod
  1. The MongoDB configuration file located at /etc/mongod.conf
  2. authorization security
  3. allowed, permitted
security:
  authorization: enabled
  1. Restart the MongoDB service to apply configuration changes.
sudo systemctl restart mongod

Now you have successfully installed and configured the MongoDB database in CentOS. You can use the mongo command line tool to connect to the database and perform further operations.

Leave a Reply 0

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