Install node.js

I just started playing around with node.js and wanted to write up a quick tutorial on running node.js on an Ubuntu Linux machine. While I wrote this specifically for Ubuntu, it should work with most Linux versions. I'm assuming you have installed git. If not you should be able run the install using the .tar.gz package fromĀ

cd /var/www
git clone git://
cd node
sudo make install

Create a test script to test your install. Inside the ~/node directory create a file called test.js and add the following.

/*As per the node.js documentation, this will allow you to test your install*/
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '');
console.log('Server running at');

Running the following command

node test

should return

Server running at

If it does open a browser and navigate to, if you see Hello World,your install was successfull.

One nice feature of node.js is it's package manager. Much like pear, node.js allows you to install application written for node.js; two of the applications I am wanting to try out are less and yuidoc. Each can be installed with a single command.

Install less

npm install -g less

Install YUIdoc

npm -g install yuidocjs