The first thing you need to have in order to be able to install Node.js is SSH access to the server. If you already know how to access your server via SSH, skip to the actual installation.
Some hosting providers will allow jailed SSH access upon request, some offer it by default so you might need to post a ticket to be able to log in.
Once you've been given SSH access you can log in by using Putty on Windows or your Terminal on a Mac. If you have Linux I assume you already know how to do that (wink).
Here's how to gain SSH access on a WHM/cPanel shared server.
Connection -> SSH -> Auth
*.ppkfile using the Browse dialog and return to the Session screen.
chmod 0600 KEY_FILE_NAME. Then type
ssh -i KEY_FILE_NAME -p PORT_OF_SERVER [email protected]_HOST. Make sure you replace the capitalized variables with the actual values you need.
curl https://raw.githubusercontent.com/creationix/nvm/VERSION_NUMBER/install.sh | bash.
nvm install --ltswhich will install the latest stable version of Node.JS and NPM.
nvm use --ltsand then you can issue
node -vto see the installed version.
nvm ls-remote --ltswhich will show you all the long term support Node.js versions that exist in the repository. Install an older one by issuing
nvm install vX.X.Xand then
nvm use vX.X.X
That's it! If you have any questions let me know in the comments section.