Daily Archives: December 16, 2014

How to install Node and NPM on Linux CentOS 5 2

Once logged into the server as root, I initially ran “yum install nodejs” and and was presented with the “no package nodejs available” message, which means yum couldn’t find it. So we need to add the EPEL repository so it can be installed with yum, and then proceed to install nodejs and npm.

#Add the EPEL Repository allow yum to intall nodejs
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

#The epel release version might be slightly different when you download it, so change the command as needed to point at the right file.
rpm -Uhv epel-release-6-8.noarch.rpm

#install node
yum install nodejs

#enter ‘y’ for the two or three prompts

#install npm
yum install npm

#enter ‘y’ for the prompt

And that’s it. If for some reason you get “no package nodejs available” still, then clear the yum cache with “yum clean all” so it uses the new repository and then try to install node again.