sudo apt-get updateOnce the update finishes, install a compiler on your server.
sudo apt-get install build-essentialAdditionally, be sure to download curl, which we will need to perform the installation itself.
sudo apt-get install curlOnce those two components have downloaded, you are all ready to install node.js.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrcFollow up by sourcing the .bashrc file:
. ~/.bashrcCreate two new directories for the installation:
mkdir ~/local mkdir ~/node-latest-installSwitch into the latest-install folder:
cd ~/node-latest-installRun curl to get the node.js tarball and subsequently untar it.
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1Once that has completed, you can go ahead and start the installation process, limiting it to the local user. This ensures that you will not need sudo later.
./configure --prefix=~/localRun make install, but be warned: it does take a while.
make installFinish up by downloading the the node package manager through curl:
curl https://npmjs.org/install.sh | shAfter you are all done, you can quickly check which version you have installed on your virtual private server.
node -v
Article ID: 223
Created On: Sun, Dec 29, 2013 at 10:22 PM
Last Updated On: Sun, Jan 5, 2014 at 8:51 PM
Authored by: ASPHostServer Administrator [asphostserver@gmail.com]
Online URL: http://faq.asphosthelpdesk.com/article.php?id=223