How to Install Mongodb Server on Ubuntu 16.04

ubuntu-mongo

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