nodejs centos install and configure the production environment

Installation nodejs and yarn commands:

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

sudo yum install yarn

Installation pm2

yarn global add pm2

Configuration package.json
shortcut commands to start the silent background:

"scripts": {
        "start": "pm2 start index.js --watch --name redredstar",
    },

pm2 log file: /root/.pm2/logs below

to view the NODE service running on the server, execute: pm2 list
delete a service, perform pm2 delete [appName]
 

Guess you like

Origin www.cnblogs.com/liulun/p/11531733.html
Recommended