Third article in our series (check the first one, the second one), now let’s install NodeJS (0.10, 0.12, 4 or 5) and PM2 on our server.

Choose version of NodeJS you would like to install. I use v4 for now.

NodeJS 5.x

1
sudo curl -sL https://rpm.nodesource.com/setup_5.x | bash -

NodeJS 4.x

1
sudo curl -sL https://rpm.nodesource.com/setup_4.x | bash -

NodeJS 0.12.x

1
sudo curl -sL https://rpm.nodesource.com/setup_0.12 | bash -

NodeJS 0.10.x

1
sudo curl -sL https://rpm.nodesource.com/setup | bash -

Then install it

1
sudo yum install -y nodejs

NPM was installed by default. We will need devtools to compile and install some native addons from npm.

1
sudo yum groupinstall 'Development Tools' # or yum install gcc-c++ make

Install PM2

1
2
sudo npm install pm2 -g
sudo pm2 startup centos # to make it load on boot

That’s it! We’ve got Node v4, NPM and PM2 on Centos 7.