Install Node.js

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Installing Node.js from source

To install Node.js from source, execute the following commands given below

$ sudo apt-get update $ sudo apt-get install build-essential -y $ sudo apt-get install gcc $ sudo apt-get install make $ sudo apt-get upgrade

Above steps are required, if you are installing nodejs in Amazon ec2

$ wget http://nodejs.org/dist/v0.6.17/node-v0.6.17.tar.gz $ tar -xf node-v0.6.17.tar.gz $ cd node-v0.6.17 $ ./configure $ make $ sudo make install

Verification

To verify node installation, open the terminal and type node to get into REPL (Read-Eval-Print Loop)

  • >$ node
  • >1+1
  • >2
  • >_
  • >2
  • >_+1
  • >3

Note If you get error on make, increase the swap memory by following the steps mentioned here