Facebook Pixel

How do I make PM2 start on system boot?

Run pm2 startup systemd, copy and run the outputted command, then run pm2 save to save the current process list. PM2 will automatically restart your apps when the server reboots.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Installing Node.js and PM2 on AWS EC2 Setting Up the Production Environment

Use the NodeSource repository: curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -, then sudo apt install -y nodejs. This installs Node.js 20 LTS and npm.

PM2 is a process manager for Node.js. It keeps your app running, restarts on crash, starts on system boot, and provides log management. Without PM2, the app stops when the SSH session ends or on an unhandled error.

Node.js 20 LTS (via NodeSource), PM2 (sudo npm install -g pm2), Nginx (sudo apt install nginx), Git (sudo apt install git), and build-essential for npm packages that require compilation.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.