Installing node with NVM
Node is not longer officially supported on CentOS 6. Either update CentOS to 7 or an easier way to install Node is to use NVM (Node Version Manager). Run the following command (check to make sure you are getting the latest version first from the official docs:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Easiest to now close and re-open your shell to start using NVM. To install the latest version of node:
nvm install node
To see which version of Node are available to install (it's a long list):
To install a specific version of node and start using it right away:
nvm install v9.11.2
To switch back to the previous version you had:
nvm use v10.12.0
Hope this is helpful.
The following is no longer supported by Node
I've been using Node, npm, bower and gulp in my local Vagrant VM under Ubuntu. However, as one of my current projects will be shuffled off to a cPanel CentOS server soon, I thought I would check how easy it is to install all this on the cPanel side. This mini-how-to assumes you are running the latest cPanel (WHM 11.42.0 (build 23) as of this writing) running on CentOS 6. Assuming you have this configuration, then you will already have git installed and running as required by npm in some instances.
First step, ensure bzip is installed
# rpm -qa|grep bzip2-devel bzip2-devel-1.0.5-7.el6_0.x86_64
If it's not installed, you will need to install it. Also be sure you have python 2.6.6 or later installed. You should if you are on the latest version of cPanel:
# python -V Python 2.6.6
For this setup I'm going to install node into /usr/local/ so all the users have access to it:
cd /usr/local/src wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz tar -zxvf node-v0.10.26.tar.gz cd node-v0.10.26 ./configure --prefix=/usr/local make make install
Node should now be installed. To ensure it is you can quickly do this:
# node -v v0.10.26
Now we can install bower and gulp:
npm install bower -g npm install gulp -g
And that's it! Now you and your users with ssh access should be able to manage their own bower and gulp setup. If you're looking for some really great tutorials on how to use Bower and Gulp and all sorts of other great PHP and Laravel development information, check out Laracasts by Jeffrey Way. It'll will most likely be the best $9 a month you've ever spent!