How to make PM2 as a autostart service? I want to make my PM2 as a startup service, because for example when my server loses power or something happens to it, it does not automatically restart the PM2 service.
When configuring PM2 is finished and it's working properly, you must run two commands to make your PM2 as a autostart service and enjoy that.
1) Run 'pm2 save': It's save all of your PM2 configure to a file.

admin@server:~$ sudo pm2 save


2) Run 'pm2 startup': This command creates a system service and runs your last change saved with the first step. 

admin@server:~$ sudo pm2 startup


So, Run the first command when you changed the configuration to store the last changes.