安装node,npm,pm2_linux

1. yum 安装node,npm

yum -y install nodejs npm

2. 使用编译好的文件安装node,npm

wget https://nodejs.org/download/release/v10.5.0/node-v10.5.0-linux-x64.tar.gz
cd /root/
         tar zxvf node-v10.5.0-linux-x64.tar.gz
ln -s /root/node-v10.5.0-linux-x64/bin/node /usr/local/bin/
         
         ln -s /root/node-v10.5.0-linux-x64/bin/npm /usr/local/bin/

3. 安装pm2

npm i -g pm2
ln -s /root/node-v10.5.0-linux-x64/lib/node_modules/pm2/bin/pm2 /usr/local/bin/