After trying several methods, i found the following way is much straight forward. Go to this link and install mongodb via that. Then open the terminal and do the followings.
$ - mkdir data
Now edit the
/etc/mongodb.conf into the
Now run the mongod server as follows.
mongod --dbpath ./data.
After trying several different methods this one works for me 🙂