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)

02 January 2020 (last updated 4 years ago)

7330 views

Written by Dennis Smink

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

Back to Server


Start free trial