I remember that I have a displayed linux server, here is the centos7 release configuration nodejs environment for bloggers (here, the latest version of v8.11 is taken as an example)
wget https://npm.taobao.org/mirrors/node/v8.11.1/node-v8.11.1-linux-x64.tar.xz
For the specific method of generating .tar decompression, please see the previous article Centos decompress nodejs compressed package
Modify the folder name after decompression (enter the installation directory and execute the first command)
mv node-v8.11.1-linux-x64 node
After executing the command, the folder name is successfully changed to node, which is the installation directory
cd /node/bin&&ls
At this time, I see that npm and node perform version name testing
. /node -v
See the return version number v.8.11.1, the installation is successful
Enter the file of the profile under home
vim ~/.bash_profile
Find PATH=$PATH:$HOME/bin
and add the path as:
PATH=$PATH:$HOME/bin:/node/bin
Then test node -v
in any directory to successfully return the version number environment variable configuration is completed.
Recommended Posts