Linux installation node notes

Note: This article takes Windows operating Linux as an example

Preparation tool
-Xftp
-Xshell

1. Prepare the node installation package

Enter the nodejs official website to download
the binary version of the compressed package of Linux downloaded below
Download node compressed package

2. Use Xftp to log on to your server

I use the sftp username and password to log in here. After logging in successfully, find the directory downloaded by the win machine and the directory you need to upload on the server, and drag it directly
Upload compressed package

3. Use Xshell to log in to the server and decompress the compressed package

cd /[YOUR_FILE_PATH]
tar xvf [YOUR_FILE_NAME] 

eg:

cd /SOFT_WARE
tar xvf node-v8.9.4-linux-x64.tar.xz

Note:
If the unzip error

tar (child): lbzip2: Cannot exec: No such file or directory 
tar (child): Error is not recoverable: exiting now 
tar: Child returned status 2 
tar: Error is not recoverable: exiting now
//上述错误请安装解压软件
yum -y install bzip2


tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
//上述错误请安装xz
yum -y install xz 

Enter the bin directory to see if it is successful

cd /nodexxxx/bin/

./node -v // 打印v8.9.4 -> 安装成功

4. Set global variables

Use soft link to set global variables

ln -s /[YOUR_FILE_PATH]/node-vx.x.x-linux-x64/bin/node /usr/local/bin/node
ln -s /[YOUR_FILE_PATH]/node-vx.x.x-linux-x64/bin/npm /usr/local/bin/npm

eg:

ln -s /SOFT_WARE/node-v8.9.4-linux-x64/bin/node /usr/local/bin/node
ln -s /SOFT_WARE/node-v8.9.4-linux-x64/bin/npm /usr/local/bin/npm

test:

cd /
node -v //v8.9.4 -> 安装成功

Guess you like

Origin blog.csdn.net/jianleking/article/details/79093680