Linux -- install nodejs (unzip the tar.xz file)

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

4. The source /etc/profile environment variable takes effect

Five, run node -v to display the version number of nodejs, the installation and configuration are successful

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325397357&siteId=291194637