How to install PM2 on Ubuntu 23.04

server
1 min read
PM2 is a daemon process manager that will help you manage and keep your application online.
This post tries to capture the steps that we need to install PM2 on our machine running Ubuntu 23.04. The same set of steps can be used to install PM2 globally on any machine already running NodeJS.
Prerequisites:
2 ways to install PM2
PM2 is a daemon process manager that will help you manage and keep your application online. It is offered as a simple and intuitive CLI, installable via NPM.
Using NPM:
npm install --global pm2
or the shorthand as:
npm i -g pm2
Using Yarn:
yarn global add pm2
Support for CLI autocompletion:
pm2 completion install
Updating PM2:
npm install pm2 -g && pm2 update
PM2 itself offers a lot of options to manage your apps in production and can be further seen in official docs.