Setup NodeJS - charleshross/soarin GitHub Wiki

This guides assumes you have already installed a fresh copy of Debian Linux Wheezy 64bit (https://www.debian.org/distrib/netinst) on your server or virtual machine.

  • Words like this are commands to run on your server or virtual machine.
  • The 'pico' text editor used in this documentation comes with Debian and is super simple to use. To open a file just type pico [location of your file]. Use arrow keys to navigate, and in order press "[CTRL]+[X], [Y], [ENTER]" to save file changes.

To begin installing, SSH into your Linux Debian server as root.

NodeJS


NodeJS is a software platform for making super-fast server-side backends and networks. Many useful client side scripts use NodeJS to do their magic. This is required for Soarin's grunt script to compile less and minify css/js files. It's also a great extra backend for things PHP may not be as good at (websockets / chat systems / job queues / real time networks).

Compiling and Installing NodeJS from Source Code


Install dependencies

apt-get install python g++

Make install directory and move into it

mkdir /opt/node

cd /opt/node

Get latest download of Node

wget http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gz

Unpack download

tar -xvf node-v0.10.29.tar.gz

Move into node source folder

cd node-v0.10.29

Configure

./configure --prefix=/opt/node

Make

make

Make Install

make install

Node should now be ready, it only runs when called

Adding binaries to bash


Add NodeJS binaries to your bash, edit your .bashrc file

pico ~/.bashrc

Add :/opt/node/bin to the end of your path line

PATH=$PATH:/opt/node/bin

Reset bash

source ~/.bashrc

Install common packages globally


Install Grunt globally (Soarin's frontend file compressor)

npm install -g grunt-cli

Install Bower globally (Useful frontend file package manager)

npm install -g bower

Install Node-Inspector globally (NodeJS debugger)

npm install -g node-inspector

Install Node-Supervisor globally (Keeps Node running by reloading on edits/errors)

npm install -g supervisor