PM2 is a process manager for node.js apps.
PM2 can be easily installed using npm package manager. Here’s how:
$ npm install pm2 -g
Once pm2 is installed there’s only one thing you need to get started which is a functional node.js app.
Let’s say our app is located at ~/myapp/index.js
$ cd ~/myapp
$ pm2 start index.js
Now we want to make sure that our pm2 process will be started after a system reboot:
$ pm2 startup
Once completed, the latest step is to save our current app list.
$ pm2 save
If you completed all the steps previously, then have a running node.js app, managed by PM2.
If you would like to have some more advanced guides on this subject, please let me know in comments section.