How to install Node.js via binary archive on Linux (node-v8.11.3-linux-x64.tar.xz)

1) Node version = node-v8.11.3-linux-x64.tar.xz
Unzip the binary archive to any directory you wanna install Node, I use /usr/local/lib/nodejs

VERSION=v8.11.3
DISTRO=linux-x64
sudo mkdir /usr/local/lib/nodejs
sudo tar -xJvf node-v8.11.3-linux-x64.tar.xz -C /usr/local/lib/nodejs
sudo mv /usr/local/lib/nodejs/node-v8.11.3-linux-x64 /usr/local/lib/nodejs

2) Set the environment variable sudo nano ~/.profile, add below to the end

# Nodejs
export NODEJS_HOME=/usr/local/lib/nodejs/node-v8.11.3-linux-x64/bin
export PATH=$NODEJS_HOME:$PATH

3) Refresh profile
. ~/.profile
( . is including within command )

4) Test installation using
$ node -v

Advertisements