Installing node.js on Debian 6.0
Solution 1
Although, as ArjunShankar says, you should normally use a pre-built package. Node.js is rather too fast moving for Debian packages to keep up. I would strongly recommend that you do your own installs until such a time as Node settles down. For example, there was an unexpected update recently that fixes an important security loophole - you do not want to be dependent on a package that is for an out-of-date version of Debian when things need to move fast.
Instead, you should install from source.
You can download the source archive direct unpack it into a temporary folder and follow the instructions on the Node Github page. Alternatively, if you are confident with GIT, you can use that to grab the source - again to a temporary folder & follow the installation instructions.
There are a number of software dependencies for compiling so you need to make sure that you have them first - they should all be in the Debian apt packages. See http://blog.timmattison.com/archives/2011/04/26/installing-nodejs-couchdb-and-npm-on-debian-the-easy-way/ or http://sekati.com/etc/install-nodejs-on-debian-squeeze for further information.
It will take a few minutes to do the compile so be patient.
Once you've done it once, upgrades are also easy - just repeat the download/compile process.
Node.js installations now include the npm tool so installing libraries and other code is extremely simple.
Solution 2
If anyone else needs step-by-step instructions, I used the following steps from Install Node.js on Debian Squeeze and it installed with no problems:
sudo apt-get update && sudo apt-get install git-core curl build-essential openssl libssl-dev
git clone https://github.com/nodejs/node.git
cd node
-
git checkout v5.0.0
(or the version you want to build) ./configure
make
sudo make install
-
node -v
npm -v
I didn't have to install any additional sources into apt to get it to build.
Solution 3
As others have mentioned, node.js has quite a rapid release cycle, and the official Debian packages lag somewhat. I have a need to keep a group of Debian servers up-to-date with node.js, so I've been using this:
https://github.com/mark-webster/node-debian
Which allows you to build .deb files for arbitrary versions of node.js, so you can install / upgrade / uninstall it easily. It's a bit quick and dirty, but at least it's something until the official Debian packages arrive.
For an insight into the complications facing Debian package maintainers regarding node.js, see this thread:
https://groups.google.com/d/msg/nodejs/W_6avRSG_a8/xeQxLGuHQ5YJ
Solution 4
Just wanted to add this:
http://ypcs.fi/howto/2012/10/09/nodejs-debian/
I successfully used this for wheezy, however I only got v0.6.19 and it is atm on 0.8.2.
Wingblade
Updated on November 14, 2020Comments
-
Wingblade over 3 years
So well, I have a vserver with Debian 6.0.
Now I would like to install Node.js, but none of the tutorials on the web seem to work. I have tried all of the results google gives me when I enter "install node.js on linux" I mostly failed because I had no idea how to install the dependencies (I'm new to linux btw)
How to install node.js on a Debian system that was just setup (so no programs already installed on it and such)?