How to install and setup Mongo DB in a minute or less

In my previous post I showed you how to install Node.js and Express.  Now we’re going to install Mongo DB.   If you’re unfamiliar with Mongo, it is a schema-less, JSON-based database that is leading the whole noSQL movement and will soon overtake DB2 in terms of popularity (sorry IBM).

Ready to go?

    1. If you followed my previous post to setup Node then your environment should be good to go. If not, go back and make sure you have Brew installed and it is up to date.  Open a terminal and type:
      $ brew install mongodb
    2. That’s it. Well except for some configuration.  Let’s do those steps now.  First create a default directory for your databases.  You’ll need root access to do this, in the terminal type:
      $ sudo mkdir -p /data/db
    3. And change permissions on the new directory:
      $ sudo chown 'id -u' /data/db
    4. Now start Mongo.
      $ mongod
      all output going to: /usr/local/var/log/mongodb/mongo.log
    5. Done, done and done.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s