1. Download the nodejs installation package
Download address: nodejs
2. Unzip the file
In most cases, it is not possible to decompress .xz files directly.
First use xz -d xxx.tar.xz to decompress xxx.tar.xz into xxx.tar, then tar -xvf xxx.tar to decompress
3. Modify the /etc/profile file
Replace the content of NODE_HOME with the installation path of nodejs and add the following content.
#SET PATH FOR NODEJS
export NODE_HOME=/opt/node-v6.10.3-linux-x64
export PATH=$NODE_HOME/bin:$PATH