There’s a ton of outdated information floating around the web on how to simply and effectively install Node.JS on CentOS, specifically one of my legacy boxes that runs 5.11. I spent about 15-20 minutes toying around with various hacky ways to do this. To save you the time, here’s the easiest way I found:
Perform (as root):
curl -sL https://rpm.nodesource.com/setup | bash -
yum install -y nodejs
If you’re a security fanatic like myself, you’ll likely want to first download the ‘setup’ script before piping it to bash. If you don’t care, I can assure you I’ve reviewed the code and rpm.nodesource.com is a trusted source.
It will output each step as it moves along, prompting you to manually install any 3rd party dependencies.
Once done, verify your install with: