Akshay Terode

A tech boffin who loves simplifying things currently doing more in big data, focused in Python and Spark.

MongoDB Setup In LINUX Based OS

10 Jun 2016 » nosql, setup

STEP 1:-
Create db-path according to MongoDB specification

sudo mkdir -p /data/db

STEP 2:-
Give RWX Permission

sudo chmod -R 777 /data/db

STEP 3:-
Download MongoDB from the official site; and Extract

cd Downloads
tar xvzf mongodb-linux-x86_64-ubuntu1604-4.0.4.tgz

STEP 4:-
Make Installation Path

sudo mkdir -p /usr/local/mongoDB

STEP 5:-
Move Extracted Files to Setup Location
CD to extracted folder of MongoDB

sudo mv /mongodb-linux-x86_64-ubuntu1604-4.0.4/* /usr/local/mongoDB

STEP 6:-
ADD mongoDB enivronment variable to ".bashrc"

sudo gedit ~/.bashrc
#`Append` at the end of `".bashrc"`
export MongoDB_HOME=/usr/local/mongo
export PATH=$PATH:/usr/local/mongo/bin

STEP 7:-
START MongoDB server

  • Start The MongoDB Server
          mongod
    
  • Start MongoDB Shell
          mongo
    

You should see mongo CLI running by now.If not you need to troubleshoot and check with the errors.

So, finally, we have seen how to install MongoDB on Ubuntu. We will learn MongoDB Programming in our further MongoDB tutorials. Feel free to ask your queries in the comment section.