How to Install MongoDB on CentOS
Introduction
MongoDB is a cross platform, free and open-source, document-oriented NoSQL database management system developed by MongoDB INC. It uses JSON like documents with schema. It is published under GNU Affero General Public License and the Apache License. In this tutorial, we will install MongoDB on CentOS 7.
Prerequisites
- CentOS 7
- Login as an administrator on the terminal
- Yum must be configured on the system.
Installation
Installation includes following steps.
1) Enable MongoDB Repository
Create a file named as /etc/yum.repos.d/mongodb-org-3.6.repo and add the text details shown in the image.
2) Install MongoDB
Now, MongoDB repository is enabled. We can install it by using following command,
3) Start MongoDB
Use the following command to start MongoDB server.
4) Working on MongoDB shell
Use the following command to connect the MongoDB server.
Just type use <database-name> (tutoraspire in my case) to create a MongoDB database.
5) Stop the Server
Use the following command to stop MongoDB server.
Extra Info
Use the following command to restart the server.
Hence, we have successfully installed and get started with MongoDB.