Centos7 install node (version 8)

The most concise command input

yum -y update

yum -y install gcc make gcc -c ++ openssl -devel wget vim (if the latter two are not selected for installation)

cd /usr/local/src

wget https://nodejs.org/dist/v8.11.1/node-v8.11.1.tar.gz

tar xvzf node-v8.11.1 .tar .gz cd node -v8 .9 .4

mv node-v8.11.1 node

 

./configure --prefix=/usr/local/node

sudo make && makeinstall

vim /etc/profile (enter i  edit mode after entering the file)

Move to file last input

  1. #set for nodejs  
  2. export NODE_HOME=/usr/local/node  
  3. export PATH=$NODE_HOME/bin:$PATH

source /etc/profile

 

node -v (the corresponding version number appears: 8.11.1 )

 

Introduce the version with a picture (the server chooses to install Source Code to choose the version)

Be sure to install  gcc make gcc -c ++ if you don't you will get an error at the end of the make command

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324519956&siteId=291194637