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