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?
- 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
- 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
- And change permissions on the new directory:
$ sudo chown 'id -u' /data/db
- Now start Mongo.
$ mongod all output going to: /usr/local/var/log/mongodb/mongo.log
- Done, done and done.