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.

CentOS How to Install MongoDB on CentOS 1

2) Install MongoDB

Now, MongoDB repository is enabled. We can install it by using following command,

CentOS How to Install MongoDB on CentOS 2
CentOS How to Install MongoDB on CentOS 3
CentOS How to Install MongoDB on CentOS 4

3) Start MongoDB

Use the following command to start MongoDB server.

CentOS How to Install MongoDB on CentOS 5

4) Working on MongoDB shell

Use the following command to connect the MongoDB server.

CentOS How to Install MongoDB on CentOS 6

Just type use <database-name> (javatpoint in my case) to create a MongoDB database.

CentOS How to Install MongoDB on CentOS 7

5) Stop the Server

Use the following command to stop MongoDB server.

CentOS How to Install MongoDB on CentOS 8

Extra Info

Use the following command to restart the server.

CentOS How to Install MongoDB on CentOS 9

Hence, we have successfully installed and get started with MongoDB.


Next TopicInstall CouchDB




Latest Courses