Here’s a guide to install pm2 and pm2-logrotate on Debian 12:

Step 1: Update the System

Make sure your system is up-to-date:

Step 2: Install Node.js (if not already installed)

If Node.js and npm aren’t installed yet, install them. Use the NodeSource setup script to get the latest stable version.

Step 3: Install pm2

Install pm2 globally using npm:

Step 4: Set up pm2 to Start on Boot

To ensure pm2 restarts your applications after a reboot, use:

The command will output another command specific to your system, so copy and run it as instructed.

Step 5: Install pm2-logrotate

Now, install the pm2-logrotate module:

This will set up log rotation for all pm2 applications by default. You can also configure pm2-logrotate with custom settings.

Step 6: Configure pm2-logrotate (Optional)

To adjust pm2-logrotate settings, use the following command:

Step 7: Verify Installation

Run the following command to verify pm2 and pm2-logrotate are active:

Now, pm2 and pm2-logrotate should be successfully set up on your Debian 12 system.

Leave A Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.