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
Second step
wget https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz
- 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
cd node-v12.16.1-linux-x64/bin
./node -v
- 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