1. Download the source code. Download the source code, you need to download the latest Nodejs version in https://nodejs.org/en/download/, this article takes v8.9.1 as an example:
cd/usr/local/src/wget http://nodejs.org/dist/v8.9.1/node-v8.9.1.tar.xz
2. Unzip the file.
Tar xvf node-v8.9.1-linux-x64.tar.xz
3. Setting the node and NPM commands is globally valid. Enter profile Edit environment variable
Cdvim/etc/profile
Add the following on the export PATH USER LOGNAME MAIL HOSTNAME histsize histcontrol Line:
Node-v8.9.2-linux-x64 (This is the name of the extracted folder, depending on the name you extracted)
#set for Nodejsexport node_home=/usr/local/node-v8.9.2-linux-x64export path= $NODE _home/bin: $PATH
: Wq Save and exit, compile/etc/profile make configuration effective
Source/etc/profile
Verify that the installation configuration is successful
Node-v
Output v8.9.2 indicates success
Npm-v
Output 5.5.1 indicates success
Play node.js-1. Install the node. JS development environment in the Novice on-road CentOS