centos7.x 安装pm2

安装

npm install -g pm2

此时执行pm2可能会提示,找不到pm2命令

创建软链接

ln -s /usr/local/nodejs/bin/pm2 /usr/local/bin/pm2
ln -s /usr/local/nodejs/bin/pm2-dev /usr/local/bin/pm2-dev
ln -s /usr/local/nodejs/bin/pm2-docker /usr/local/bin/pm2-docker
ln -s /usr/local/nodejs/bin/pm2-runtime /usr/local/bin/pm2-runtime

ln -s /usr/local/nodejs/bin/pm2 /usr/bin/pm2
ln -s /usr/local/nodejs/bin/pm2-dev /usr/bin/pm2-dev
ln -s /usr/local/nodejs/bin/pm2-docker /usr/bin/pm2-docker
ln -s /usr/local/nodejs/bin/pm2-runtime /usr/bin/pm2-runtime

启动nodejs 服务

pm2 start /www/wwwroot/xxxxxx/pm2.yaml

保存服务开机自启动

pm2 startup
pm2 save

你可能感兴趣的:(centos7.x 安装pm2)