use wiget to install node.js in centos

created at 12-28-2021 views: 8

download

you can check https://nodejs.org/dist/ archive for versions you'd like.

then you can download with wget like bellow:

wget https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz

decompress

tar -xvf  node-v8.0.0-linux-x64.tar.xz

Test whether the installation is successful

Enter the bin directory under the unzipped directory and execute the ls command

cd node-v8.0.0-linux-x64/bin && ls

There should be node and npm.

test

./node -v

you will get your version number of node.js.

Successful installation

make npm and node global

Now node and npm cannot be used globally, lets make a link

ln -s /www/node-v8.0.0-linux-x64/bin/node /usr/local/bin/node

ln -s /www/node-v8.0.0-linux-x64/bin/npm /usr/local/bin/npm

Now you can execute node and npm commands in any directory

Note:

You can check the environment variable echo $PATH

created at:12-28-2021
edited at: 12-28-2021: