Showing posts with label nodejs. Show all posts
Showing posts with label nodejs. Show all posts

Sunday, March 02, 2014

Installing Node.js on Ubuntu 12.04

Download the source of Node.js for Linux. Make sure you have the Ubuntu package 'build-essential' already installed before building Node.js.

You can check if Ubuntu package 'build-essential' is already installed by issuing the following command on the terminal:

suleman@devbox:~$apt-cache policy build-essential 
build-essential:
  Installed: 11.5ubuntu2.1
  Candidate: 11.5ubuntu2.1
  Version table:
 *** 11.5ubuntu2.1 0
        500 http://gb.archive.ubuntu.com/ubuntu/ precise-updates/main amd64

The above Installed line indicates, which version of  'build-essential' is installed, if it was not installed then you would have seen something like the following:
build-essential:
  Installed: Installed: (none)
  Candidate: 11.5ubuntu2.1
  Version table:
 *** 11.5ubuntu2.1 0
        500 http://gb.archive.ubuntu.com/ubuntu/ precise-updates/main amd64

If you don't have package 'build-essential' installed then please install it:
suleman@devbox:~$sudo apt-get install build-essential

Issue the following commands in the terminal to build Node.js for local use as opposed to system wide use:
suleman@devbox:~$tar xzf node-v0.10.26.tar.gz
suleman@devbox:~$cd node-v0.10.26
suleman@devbox:~/node-v0.10.26$./configure
suleman@devbox:~/node-v0.10.26$make
suleman@devbox:~/node-v0.10.26$mkdir ~/local
suleman@devbox:~/node-v0.10.26$./configure --prefix=~/local
suleman@devbox:~/node-v0.10.26$make && make install

Then  I would add the following in your ~/.bashrc:
export PATH=~/local/bin:$PATH

Either open new terminal or source ~/.bashrc in current terminal and check you have node installed successful:
suleman@devbox:~$node -v
v0.10.26

I installed Node.js for tutorial I was doing on AngularJS, once I have finished this tutorial I am hoping to have look in anger at Node.js for server side programming.

The book Node: Up and Running looks good for Node.js server side programming.