Summarize the installation Nodejs under CentOS and configure the environment to record the method of successful installation. The recommended installation method is to use the compiled binaries installed, not recommended to use the form of source code installation, one is the source of trouble, the second is the need to download and compile their own waste time.
1. Installing Nodejs
Visit Nodejs's official website of Downdolad, url: https://nodejs.org/en/download/, you can see the latest Nodejs downloads, including different versions, as shown below.
Back to the Linux virtual machine, in console input
wget https://
According to the downloaded file you can see that it is compressed in. XZ mode, so you cannot download directly using the Linux command tar.
Xz-d NODE-V8.9.0-LINUX-X64.TAR.XZ
TAR-XVF Node-v8.9.0-linux-x64.tar
MV Node-v8.9.0-linux-x64 node-v8.9.0
To verify that node can be used, we can enter the CD Node-v8.9.0/bin, enter the./node-v to view the node version and successfully install the node version.
2. Configure Nodejs
To be able to use node globally, you need to add a connection to the console and enter the following command to implement it.
Ln-s/root/node-v8.9.0/bin/node/usr/local/bin/node -s/root/node-v8.9.0/bin/npm/usr/local/bin/npm
Prior to installing CentOS is the 5.8 version of XZ that is not installed GLIBC version is also low and does not support the latest Nodejs version.
Installing Nodejs and configuring the environment under the Linux system (Centos)