How to Install Mongodb Server on Ubuntu 16.04

ubuntu-mongo

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 www.mongodb.com

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

Step 1. Login into your Linux Machine.

Step 2. Update packages.

# apt-get update

Step 3. Install MongoDB Server by using below command.

# apt-get install mongodb-server -y

Step 4. Open MongoDB Shell by using below command.

# mongo

Step 5. Create & switch into a new database.

> use employee

Step 6. Create a new root user named myuser.

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

user-creation-page-pic

Step 7. Execute below command to view Users list.

> db.getUsers()

view-users