To deploy a React app using PM2 on Rocky Linux 9, follow the steps below.
Step 1 : Begin by installing PM2 using npm:
Step 2 : Set up PM2 to start on system boot:
Step 3 : Create a React App
- Create a new React app using the following command:
- Navigate to the app's directory and build it:
Step 5 : Start the React app using PM2:
Step 6 : If you are using a firewall, make sure to allow traffic on the specified port (3000 in this case).
Step 7 : Open your browser and test the deployed React app.
Step 8 : Manage the Application
Use the following commands to manage your application:
- Check status:
- Restart:
- Reload (hot reload without downtime):
- Stop:
- Delete:
Congratulations! You have successfully deployed a React app using PM2 on Rocky Linux 9.