Installing node.js on ubuntu 10.04

With all the euphoria about node.js since the last few months, I finally decided to give it a try. As it is not available for Windows, I decided to install it on Linux instead of going for Windows/Cygwin. node.js is a implementation of CommonJS, a JavaScript ecosystem in development to be used for developing application outside the browser, like:

– Server-side JavaScript applications
– Command line tools
– Desktop GUI-based applications

Installing node.js

As mine was a clean Ubuntu installation, I needed to install certain libraries first.

sudo apt-get install g++ curl libssl-dev apache2-utils

The easiest way is to download node.js is to get a git clone. For that I needed to install the git package.

sudo apt-get install git-core

Now download node.js with git.

git clone git://

If you do not want to use git you could get the tar package instead.

gunzip node-v0.1.96.tar.gz
tar -xf node-v0.1.96.tar

Now you are ready to install node.js.

cd node
sudo make install

Example node.js code

Below is a simple program using node.js for translating text using google API.

var http = require('http');
var url = ('')
var google = http.createClient(80, url);
var text = "Hello World from node!";
var requestUrl = '/ajax/services/language/translate?v=1.0&q=' + 
                 escape(text) + '&langpair=en%7Cfr'
var request = google.request('GET', requestUrl, 
              {"host": ""});
request.addListener('response', function (response) {
  	var body = '';
	response.addListener('data', function (chunk) {
		body += chunk;
    response.addListener("end", function() {
        var jsonData = JSON.parse(body);

This simple example does not to justice to the true power of node.js. I’ll be posting useful examples in the near future. Keep watching.

27 thoughts on “Installing node.js on ubuntu 10.04

  1. Beside the new repo location, it’s also likely you will want a more stable version, rather than the latest. At the root of the repo, after cloning and before building:

    git checkout v0.4.7

    (v0.4.7 as an example)

  2. Thanks for the straightforward and accurate instructions to get started with node.

  3. If you are installing on a bare system then you would have to install build-essential aswell.

    apt-get install build-essential

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>