Node environment deployment
Method one, source installation
step1: Download the source installation package
cd /root/
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0.tar.gz
step2: unzip
cd /root/
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0.tar.gz
tar -xf node-v10.16.0.tar.gz
step3: compile and install
cd node-v10.16.0
./configure
make && make install
step4: View node
node -v
npm -v
Method two, yum installation
step1: install eper source, update yum source
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
yum makecache fast
step2: Install the corresponding version of node
curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -
step3: install node
yum -y install nodejs
step4: Check the version of node and npm
node -v
npm -v
Method three, binary installation (recommended)
step1: Download the binary installation package
cd /root
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz
step2: Unzip and configure environment variables
tar -xf node-v10.16.0-linux-x64.tar.xz -C /usr/local
echo 'export NODE_HOME=/usr/local/node-v10.16.0' >> /etc/profile
echo 'export PATH=$NODE_HOME/bin/:$PATH' >> /etc/profile
source /etc/profile
step3: View node
node -v
npm -v
Npm domestic source configuration
Permanent configuration
npm config set registry --registry=https://registry.npm.taobao.org
Temporary configuration
npm install -g grunt-cli --registry=https://registry.npm.taobao.org
npm install express --registry=https://registry.npm.taobao.org