How to install PM2 on Ubuntu?

Yobi Bina Setiawan
28 Jan 2025 ยท FrontEnd and DevOps

PM2 is a popular process manager for Node.js applications. It's designed to help you manage and keep your applications running smoothly in production environments, Let's Learn!

You can follow these steps:

  1. Update your package list: Open your terminal and run:

    bash
    sudo apt update
  2. Install Node.js: If Node.js is not already installed, you can install it by running:

    bash
    sudo apt install nodejs
  3. Install npm (Node Package Manager): If npm is not already installed, you can install it by running:

    bash
    sudo apt install npm
  4. Install PM2 globally using npm: Once you have Node.js and npm installed, you can install PM2 globally by running:

    bash
    sudo npm install -g pm2
  5. Verify the installation: After the installation is complete, verify that PM2 is installed correctly by checking its version:

    bash
    pm2 --version

That's it! PM2 is now installed on your Ubuntu system and ready to use for managing your Node.js applications.

Keep Healthy and Happy Coding! ๐Ÿ˜‰