To install PM2 on CentOS Stream 10, follow these steps to set up and manage your Node.js applications efficiently.
Step 1 : First, you need to install PM2 globally using npm. Open your terminal and run the following command:
Step 2 : After installing PM2, you need to set it up to start on boot. Run the following command:
Step 3 : Create a simple Node.js application. For example, create a file app.js
with the following content:
Step 4 : Now, start the application using PM2:
Step 5 : Manage the App with PM2
You can manage your application using PM2 with the following commands:
- To restart the app:
- To reload the app:
- To stop the app:
- To delete the app from PM2's process list:
Congratulations, you have successfully installed PM2 on CentOS Stream 10 and managed a simple Node.js application!