Learn how to install PM2 on Ubuntu 26.04 with this easy step by step guide. Install PM2, manage Node.js applications, enable auto startup, and monitor processes with simple commands.
PM2 is one of the most popular process managers for Node.js applications. It keeps your application running, automatically starts it after a server reboot, and provides simple commands to monitor logs and running processes.
This guide shows how to install PM2 on Ubuntu 26.04 using the latest recommended method.
Prerequisites
Before installing PM2, make sure you have:
- Ubuntu 26.04 server
- A user with sudo privileges
- Node.js and npm installed
You can verify that Node.js and npm are available by running:
node -v
npm -v
If both commands return a version number, you are ready to install PM2.
Step 1: Update the Package Index
Start by refreshing your package list.
sudo apt update
This ensures Ubuntu uses the latest package information during installation.
Step 2: Install Node.js and npm
If Node.js is not already installed, install it with:
sudo apt install nodejs npm
After the installation finishes, confirm everything is working.
node -v
npm -v
You should see the installed version numbers for both commands.
Step 3: Install PM2
Install the latest PM2 package globally with npm.
sudo npm install -g pm2@latest
This makes the pm2 command available from anywhere on your server.
Step 4: Verify the Installation
Check that PM2 has been installed successfully.
pm2 -v
The command displays the installed PM2 version.
Step 5: Start Your Application
Move to your project directory.
cd /path/to/your/application
Start your Node.js application.
pm2 start app.js
Replace app.js with your application's entry file if it has a different name.
You can also assign a custom name to the application.
pm2 start app.js --name myapp
Naming your application makes it easier to manage when running multiple services.
Step 6: View Running Applications
Display all applications managed by PM2.
pm2 list
The output includes the application name, status, memory usage, uptime, and process ID.
Step 7: View Application Logs
To monitor your application's logs in real time, run:
pm2 logs
Press Ctrl + C to stop viewing the logs.
Step 8: Configure PM2 to Start After Reboot
Generate the startup service.
pm2 startup
PM2 displays another command that is specific to your system.
It usually looks similar to this:
sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u $USER --hp $HOME
Copy and run the command exactly as shown on your server.
After that, save your current process list.
pm2 save
Your applications will now start automatically whenever the server boots.
Common PM2 Commands
Start an Application
pm2 start app.js
List Running Applications
pm2 list
Restart an Application
pm2 restart myapp
Stop an Application
pm2 stop myapp
Delete an Application
pm2 delete myapp
Monitor Running Applications
pm2 monit
View Logs
pm2 logs
Save the Current Process List
pm2 save
Update PM2 to the Latest Version
sudo npm install -g pm2@latest
pm2 update
The pm2 update command refreshes the running PM2 daemon after upgrading.
Conclusion
You have successfully installed PM2 on Ubuntu 26.04. Your Node.js applications can now be started, monitored, restarted, and configured to launch automatically after every server reboot. PM2 also provides useful tools for viewing logs, monitoring resource usage, and managing multiple applications from a single interface.

