linux deployment under nodejs


Under linux nodejs deployment

1, download nodejs

https://nodejs.org/en/download/ website,

wget -c https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64. tar.xz

installation after downloading xz ready to unpack,
yum -y install xz
and then decompress, xz -d nodejs * .tar.xz, then mv renamed nodejs, then cp -r to / opt / directory,

create a soft link
ln - S / opt / NodeJS / bin / NPM / usr / local / bin /
LN -s / opt / NodeJS / bin / Node / usr / local / bin /

last try, node -v, npm -v.


2, yarn installation

Installation site: https: //www.yarnpkg.com/zh-Hant/docs/install#centos-stable

installation steps:
https://www.yarnpkg.com/zh-Hant/docs/install#centos -STABLE
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | TEE /etc/yum.repos.d/yarn.repo sudo
sudo yum -y install the Yarn

3, install nginx
https://lnmp.org/install.html
lazy, directly installed. Remember download screen, vim, you can directly select and install nginx accelerator

pm2 installation, npm install -g pm2
LN -s / opt / nodejs / bin / pm2 / usr / local / bin /

create users, and then let the user run nodejs

pm2 Start / Home / NodeJS / WWW / node_admin / bin / WWW --name = "web.admin" --merge-logs-DATE---log = the format "YYYY-the mM-DD HH: mm the Z"
PM2 Start / Home / NodeJS / WWW / node_agent / bin / WWW --name = "web.agent" --merge-logs-DATE---log = the format "YYYY-the mM-DD HH: mm the Z"
PM2 Start / Home / NodeJS / www / node_partner / bin / www --name = "web.partner" --merge-logs --log-date-format = "YYYY-mM-DD HH: mm Z"

self restart
sudo pm2 startup

Guess you like

Origin www.cnblogs.com/partman/p/11098282.html
Recommended