node installation environment and pm2

A, node installation

Software Address: https://nodejs.org/en/download/

image

#1、下载软件包
[root@node ~]# mkdir /app
[root@node ~]# cd /app/
[root@node app]# wget https://nodejs.org/dist/v12.13.1/node-v12.13.1-linux-x64.tar.xz
[root@node app]# ll
total 13740
-rw-r--r-- 1 root root 14067172 Nov 19 16:39 node-v12.13.1-linux-x64.tar.xz

#2.解压缩
[root@node app]# tar xf node-v12.13.1-linux-x64.tar.xz -C /usr/local/
[root@node app]# cd /usr/local/
[root@node local]# ls
bin  etc  games  include  lib  lib64  libexec  node-v12.13.1-linux-x64  sbin  share  src
[root@node local]# mv node-v12.13.1-linux-x64/ node
[root@node local]# ls
bin  etc  games  include  lib  lib64  libexec  node  sbin  share  src

#3、配置环境变量
[root @ node local] # vim / etc / Profile 
Export the PATH = / usr / local / the Node / bin: $ the PATH 
[root @ node local] # Source / etc / Profile 

# 4, to see if the installation was successful 
[root @ node local ] # the Node -v 
v12.13.1

Two, pm2 installation and use

2.1 Introduction

1) PM2 is a node process management tool, you can use it to simplify many tedious tasks node application management, such as performance monitoring, automatic restart, load balancing, and very simple to use.

Run 2) PM2 need to support environment and Npm of Node

2.2 Installation

[root@node 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] 
# if a network problem, can refer to the following articles
added in 48.781s from 206 Packages Contributors 202

https://cnodejs.org/topic/4f9904f9407edba21468f31e

2.3, commonly used commands

Guess you like

Origin www.cnblogs.com/hujinzhong/p/11994526.html