Following instructions were tested on a RackSpace Cloud Server. It should work for any other reasonably configured, mostly bare-bones Debian Lenny and latest Ubuntu (e.g. on other popular hosting options like: SliceHost, Linode etc.).
First, let's install some essentials:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential
$ gcc -v
$ make -v
$ sudo apt-get install python-software-properties
$ sudo apt-get install libssl-dev libreadline-dev
$ sudo apt-get install git-core curl
Now we can proceed with Node.js installation. There are two ways to install Node.js, directly (not recommended due to maintenance cost) or with a version manager like nvm (highly recommended in most cases):
Method 1: Installing Node.js with NVM
Attention: this is the recommended way.
$ git clone git://github.com/creationix/nvm.git ~/.nvm
$ . ~/.nvm/nvm.sh
$ nvm ls
$ nvm install v0.4.12
$ nvm alias default v0.4.12
$ nvm ls
$ nvm help
Please make sure to add following line to your (and by "your" we mean the user which node apps will be executed as) ~/.bashrc or ~/.profile:
. ~/.nvm/nvm.sh
You may want to log out and log back in, to test that login scripts work.
Method 2: Compiling Node.js from sources yourself
Attention: this is NOT recommended. You should use NVM or Nave instead.
$ cd /usr/local/src/
$ sudo wget http://nodejs.org/dist/node-v0.4.8.tar.gz
$ sudo tar xzvf node-v0.4.8.tar.gz
$ cd node-v0.4.8
$ sudo ./configure
$ sudo make
$ sudo make install
$ whereis node
$ node -v
Installing NPM Package Manager