How to Install MongoDB Server on Centos 7


MongoDB is a free and open-source cross-platform document-oriented database program. MongoDB is a NoSQL database program and uses JSON-like documents with schemas. MongoDB supports many NoSQL database types.

  • Document databases
  • Graph stores
  • Key-value stores
  • Wide-column stores

To know more about MongoDB visit

In this article we will learn how to install MondoDB server on Centos machine.

Step 1. Login into your Linux Machine.

Step 2. Add the repository of MongoDB in the yum server.

vi /etc/yum.repos.d/mongodb.repo
name=MongoDB Repository

Step 3. Install MongoDB Server by using below command.

# yum install mongodb-org -y

Step 4. Start MongoDB Server.

# service mongod start

Step 5. Open MongoDB Shell by using below command.

# mongo

Step 6. Create & switch into a new database.

> use employee

Step 7. Create a new root user named myuser.

 > db.createUser(
     user: "myuser",
     pwd: "1234",
     roles: ["readWrite", "dbAdmin"] 
} );


Step 8. Execute below command to view Users list.

> db.getUsers()