Install Node.js and PM2 (JavaScript applications)
Host Node.js applications (API, bots, web applications) in a stable manner.
What this tutorial does
The tutorial "Install Node.js and PM2 (JavaScript applications)" helps you achieve this goal:
Host Node.js applications (API, bots, web applications) in a stable manner.
Debian/Ubuntu
-
Install Node.js LTS via NodeSource: -
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - -
apt install -y nodejs -
Check versions: node -v && npm -v -
--- Install PM2 (process manager) --- -
npm install -g pm2 - --- Start an application ---
-
pm2 start app.js --name "mon-app" -
--- Useful PM2 commands --- -
List processes: pm2 list -
View logs: pm2 logs mon-app -
Restart: pm2 restart mon-app -
Stop: pm2 stop mon-app - --- Automatic start at boot ---
-
pm2 startup (copy and run the generated command) -
pm2 save (save the list of active processes)