We're here to assist with any of your needs, don't hestitate to reach out.
MongoDB is a popular open-source, NoSQL database program that provides high performance, scalability, and flexibility. It is designed to handle large volumes of data and is commonly used for web applications, mobile applications, and real-time analytics.
The first step is to add the MongoDB repository to the system. Open a terminal and run the following command to create a repository file:
$ sudo vi /etc/yum.repos.d/mongodb-org-4.4.repo
Paste the following repository configuration into the file:
[mongodb-org-4.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
Save and exit the file.
Now, use the following command to install MongoDB:
$ sudo yum install -y mongodb-org
This command will install the latest stable version of MongoDB along with required dependencies.
Once the installation is completed, start and enable the MongoDB service by running the following commands:
$ sudo systemctl start mongod $ sudo systemctl enable mongod
MongoDB will now start running as a background service on your CentOS 7 system.
To verify that MongoDB is installed and running correctly, use the following command:
$ mongo --version
This command will display the MongoDB version installed on your system.
By default, MongoDB listens on the localhost interface. To allow remote access to the MongoDB server, you need to modify the MongoDB configuration file.
Open the MongoDB configuration file using the following command:
$ sudo vi /etc/mongod.conf
Look for the line that starts with "bindIp". Change the value to your server's IP address or set it to 0.0.0.0 to listen on all available network interfaces.
Save and exit the file.
After making the configuration changes, restart the MongoDB service:
$ sudo systemctl restart mongod
Congratulations! You have successfully installed MongoDB on CentOS 7. You can now start using MongoDB for your web applications or any other projects that require a robust database system.
It is essential to ensure proper security and authentication measures are in place when deploying MongoDB in production environments.
What our customers say about us
Create your free account today.