Install first for ubuntu:
sudo apt-get install build-essential libssl-dev curl git-core
Compile the required node version and put in global reach:
# install nodejs from Github (replace 0.8.9 with required version)
git clone git://github.com/joyent/node.git node0.8.9