1,下载nodejs压缩包
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz
2,解压
tar xf node-v10.16.0-linux-x64.tar.xz
3,设置环境变量
vim /etc/profile
export PATH=$PATH:/你的解压目录/node-v10.16.0-linux-x64/bin
source /etc/profile
4,验证
npm -v
node -v