- BEHAVIOR CONFIGURATION
- SUPPORT SOURCE MAP
- INTEGRATION OF CONTAINERS
- WATCH AND RELOAD
- LOG MANAGEMENT
In this article, we will try to find out how you can install PM2 and run the basic setup on Ubuntu 18.04.
Installing PM2 via NPM
Installing PM2 is very simple and can be done with one line of code.
npm install -g pm2
Setting up PM2 to run your project
Start by navigating to your project directory. You can do this by typing the cd command followed by a directory.
To start the application, enter the command pm2 start and then specify the location of your application
pm2 start /project/app.js
Next, you will be presented with a table that you can see below:
Launch PM2 as a Service
After running the above code, it is recommended that you configure PM2 as a service so that it can start when the server starts.
env PATH=$PATH:/usr/local/bin pm2 startup -u root
Be sure to replace root with your username if you are not using it as root