CentOS7 install Nodejs detailed explanation

first step

  • Go to the directory you want to install (in this paper /usr/local/node/under)
  • Install gcc, make, openssl, wget (if you have installed it before, you can ignore this operation)
yum install -y gcc make gcc-c++ openssl-devel wget

Insert picture description here

Second step

wget https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz

Insert picture description here

  • The suffix is xz, we use xz to download
xz -d node-v12.16.1-linux-x64.tar.xz 
  • Grant permissions and unzip
chmod 777 node-v12.16.1-linux-x64.tar
tar -xvf node-v12.16.1-linux-x64.tar

third step

  • View version
cd node-v12.16.1-linux-x64/bin
./node -v

Insert picture description here

  • The version information appears, indicating that the installation was successful.

the fourth step

  • Establish a soft connection so that it can be used globally
ln -s /usr/local/node/node-v12.16.1-linux-x64/bin/node /usr/local/bin/node  
ln -s /usr/local/node/node-v12.16.1-linux-x64/bin/npm /usr/local/bin/npm

Insert picture description here

Guess you like

Origin blog.csdn.net/JISOOLUO/article/details/105023685