How to Install PM2 in Ubuntu 24.04

To install PM2 on Ubuntu 24.04, follow the steps below.

Step 1 : Install PM2

Step 2 : To ensure PM2 starts on system boot, run:

Step 3 : Build a Simple Node.js App

- Create a simple Node.js application. For example, create a file named app.js with the following content:

Step 4 : Navigate to the directory where your Node.js app is located and start it with PM2:

Step 5 : You can manage your Node.js apps using PM2 commands. Some common ones include:

- Restart an app:

- Reload an app without downtime:

- Stop an app:

- Delete an app from PM2:

Congratulations! You have successfully installed PM2 on Ubuntu 24.04 and deployed a simple Node.js application using PM2.