1. wget command to download the node. JS installation package. (The installation package is a compiled file, and after extracting it, node and NPM already exist in the Bin folder without having to compile again.) )
wget https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-x64.tar.xz
2, unzip the file.
Tar xvf node-v6.9.5-linux-x64.tar.xz
3. Create a soft link to make the node and NPM commands globally valid.
By creating a soft link method, you can use the node and NPM commands directly in any directory:
Ln-s/root/node-v6. 9.5-linux-x64/bin/node/usr/local/bin/-s/root/node-v6. 9.5-LINUX-X64/BIN/NPM/USR/LOCAL/BIN/NPM
(Note at this time: where the package decompression, if the extract in the root directory is this, use PWD to view the current directory, and then write the path according to the current directory )
4. View the node, NPM version. Also detects if the installation was successful
Node-vnpm-v
Deploy the node. JS Environment-Install multiple versions with NVM
The NVM (Node version manager) is a version management software for node. js that makes it easy for users to switch between different versions of node. js. For users who have been working on node development for a long time or who have quickly updated node version and quickly switched node version.
Installation steps:
1, directly using Git to clone the source code to the local ~/.NVM directory, and check the latest version. (Personally think git loaded, because the previous upload code to the server, the use of FTP, so when the code changes, it is necessary to choose the code to modify the file upload, more trouble, git will use Git to serve, the first clone, after the git pull merge code)
Yum Install gitgit clone https: // github.com/cnpm/nvm.git ~/.nvm && cd ~/.nvm && git checkout ' git describe--abbrev=0--tags '
2. Activate NVM.
" . ~/.nvm/nvm.sh " >>/etc//etc/profile
3. List all versions of node. js.
NVM list-remote
4. Install multiple versions of node. js.
NVM install V6. 9.5
5. View the version of node. js that is installed, and the version currently in use is v6.9.5.
[email protected]. nvm]# NVM ls
6. Toggle the node. js version to v7.4.0.
[email protected]. nvm]# NVM use v7.4.0now using node v7.4.0
Original link: https://help.aliyun.com/document_detail/50775.html?spm=5176.product25365.6.717.RCZiK5
node and git installation on Linux (CentOS)