This is the 1st in series of posts leading up to the 4th annual Node.js Knockout about how to use node.js.

This post covers how to install node and npm on three popular development platforms: Mac, Ubuntu, and Windows.

Instructions for other platforms can be found on the Node Wiki.

The Easy Way

We personally use package managers to make it easier to keep our node installation up to date, so that’s the approach we generally describe below.

However if you want to skip the steps and download pre-built binaries, you can do so at Joyent’s site: download a binary.


  1. Go to
  2. Click install, (to download the pkg).
  3. Open the pkg and run through the install process.

That’s it! Check it worked with a simple Hello, World! example.


On the latest version of Ubuntu, you can simply:

sudo apt-get install nodejs nodejs-dev npm

On earlier versions, you might need to update your repository:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs nodejs-dev npm

Then, check it worked with a simple Hello, World! example.


Since Windows package managers are less common, we recommend just downloading the Windows binary.

Other Linux distributions

If you need help installing in other Linux distributions, you can consult Joyent guide for Mint, Elementary OS, Debian, LMDE, openSUSE, SLE, Fedora, RHEL/CentOS/Scientific Linux 6, Arch Linux and more.

Hello, Node.js

Here’s a quick program to make sure everything is up and running correctly.

// hello_node.js
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Node.js\n');
}).listen(8124, "");
console.log('Server running at');

Run the command by typing node hello_node.js in your terminal.

Now, if you navigate to in your browser, you should see the message.


You’ve installed node.js and npm.

  1. kidshenlong reblogged this from nodeknockout
  2. nodeknockout posted this
Blog comments powered by Disqus