Matomo Analytics

Documentation

How do I install PM2 on a Ubuntu server?

PM2 is a process management system to keep certain processes a live. This could be either a script you have created or a socket server for example. H...

PM2 is a process management system to keep certain processes a live. This could be either a script you have created or a socket server for example.

How do you install PM2 on a ubuntu server? Very easy, run this command:

npm install pm2@latest -g

Note: You need to have npm installed before you can run this command. You can also use yarn to install PM2.

And thats it! You are now ready to start using PM2 to run your processes.

Lets say you have a bash script called socket.sh to run a socket server. You can start script and keep it alive by running:

pm2 start socket.sh

You will now get a list right away of the running processes that PM2 is keeping alive for you. (There is a lot of configuration parameters you can send too)

Dennis Smink

Written by Dennis Smink

Dennis brings over 13 years of hands-on experience in server management, specializing in optimizing web services for scalability and security.

Ready to dive in?
Start your free trial today.

Create an account and enjoy your 5-day free trial — no credit card required.

Start your free trial