Install Node.js on Debian 6

DEPRECATED: This post may no longer be relevant or contain industry best-practices.

If you're like me, you prefer to install Linux packages via the systems package manager. By doing so, whenever you run your update command, you're going to get the most current copy of everything. Unfortunately, Debian doesn't seem to have Node.js in their package repo by default:

$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree 
Reading state information... Done
E: Unable to locate package nodejs

Oh no! Thankfully, we can download the package source and compile it that way. Unlike a lot of tarballs I've used throughout the years, I've yet to have a hitch compiling Node on any of my Debian machines.

Run the following commands to get Node.js installed on your machine. In my example I'm grabbing the latest, v0.8.16, but you'll want to visit the download page and get the URL of the most current version.

$ sudo apt-get install build-essential
$ wget
$ tar -xzf node-v0.8.16.tar.gz
$ cd node-v0.8.16/
$ ./configure
$ make
$ sudo make install

If everything went as plan, you should have both node and npm installed and ready to go:

$ node -v
$ npm -v
Thomas Hunter II Avatar

Thomas is the author of Advanced Microservices and is a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.