How to quickly install and configure Node.js under linux server

Simple and rude, first use xshell or other software to connect to the server

1. Download (the version here is modified according to the official website version)

wget https://npm.taobao.org/mirrors/node/v8.9.3/node-v8.9.3-linux-x64.tar.xz

2. Unzip

xz -d node-v8.9.3-linux-x64.tar.xz someone tar -xzvf node-v8.9.3-linux-x64.tar.gz
tar -xvf node-v8.9.3-linux-x64.tar

3. Configure environment variables (need to be executed in the root directory)

ln -s /root/node-v8.9.3-linux-x64/bin/node /usr/local/bin/node
ln -s /root/node-v8.9.3-linux-x64/bin/npm /usr/local/bin/npm

4. Check whether the installation is successful (if the correct version number appears, the installation is successful)

node -v
npm -v

Note: The download dependency of the lower version of npm is relatively slow. Use the following command to upgrade npm to the latest version

npm install -g npm

Guess you like

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