zhuangzi 2019-12-06
软件地址:https://nodejs.org/en/download/
#1、下载软件包 [ ~]# mkdir /app [ ~]# cd /app/ [ app]# wget https://nodejs.org/dist/v12.13.1/node-v12.13.1-linux-x64.tar.xz [ app]# ll total 13740 -rw-r--r-- 1 root root 14067172 Nov 19 16:39 node-v12.13.1-linux-x64.tar.xz #2.解压缩 [ app]# tar xf node-v12.13.1-linux-x64.tar.xz -C /usr/local/ [ app]# cd /usr/local/ [ local]# ls bin etc games include lib lib64 libexec node-v12.13.1-linux-x64 sbin share src [ local]# mv node-v12.13.1-linux-x64/ node [ local]# ls bin etc games include lib lib64 libexec node sbin share src #3、配置环境变量 [ local]# vim /etc/profile export PATH=/usr/local/node/bin:$PATH [ local]# source /etc/profile #4、查看是否安装成功 [ local]# node -v v12.13.1
1)PM2是node进程管理工具,可以利用它来简化很多node应用管理的繁琐任务,如性能监控、自动重启、负载均衡等,而且使用非常简单。
2)PM2的运行需要Node 环境和Npm的支持
[ local]# npm install -g pm2 /usr/local/node/bin/pm2 -> /usr/local/node/lib/node_modules/pm2/bin/pm2 /usr/local/node/bin/pm2-dev -> /usr/local/node/lib/node_modules/pm2/bin/pm2-dev /usr/local/node/bin/pm2-docker -> /usr/local/node/lib/node_modules/pm2/bin/pm2-docker /usr/local/node/bin/pm2-runtime -> /usr/local/node/lib/node_modules/pm2/bin/pm2-runtime npm WARN optional SKIPPING OPTIONAL DEPENDENCY: (node_modules/pm2/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for : wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) + added 206 packages from 202 contributors in 48.781s #如果存在网络问题,可以参考如下文章 https://cnodejs.org/topic/4f9904f9407edba21468f31e