See setting up ubuntu server cheat sheet.
sudo apt-get install g++ curl libssl-dev
sudo apt-get install git-core
git clone git://github.com/joyent/node
cd node
./configure
make
sudo make install
Install NPM (Node Package manager)
Isaac Schlueter suggests giving yourself permission to the “/usr/local directory instead of using sudo. You should read his post.
sudo chown -R $USER /usr/local
curl http://npmjs.org/install.sh | sh
Help:
npm help
Install:
npm install |your package|