Below are the step to setup the development environment of node.js using Mongodb:

  1. Open terminal and add the repo executing follwing command on console
     sudo add-apt-repository ppa:chris-lea/node.js 
  2. Execute
    sudo apt-get update
  3. Execute
    sudo apt-get install nodejs
  4. Once installation completed execute
    node --version

    to check the node.js version and make sure that node is install properly

  5. When we install the node.js we have also installed npm (node package manager)
  6. Excute
    npm --version

    to insure that node package manager is installed properly

Now we are done with node.js installation. Now we need to install mongodb. Below are the step to install mongodb :

Again we will install the mongodb from terminal.

    1. Open terminal and import the public key using
      sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 

      command

Execute command

echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
  • Execute
    sudo apt-get update 
  • Execute
    sudo apt-get install mongodb-org 

    for installing the mongodb. You can also specify the version of the mongodb eg(sudo apt-get install mongodb-org=2.6.1)

  • Once You are done with mongodb installation execute

    mongo –version

    to make sure that mongodb is installed properly.

Now we are ready to develop web application using node.js. In my next blog you can find how to create web-application using node.js.