Run as root on RHEL, CentOS or Fedora:
Then install, as root:
-y flag will automatically answer “yes” to every confirmation question, so leave it out if you want to be able to say no to something.
Optional: install build tools
To compile and install native addons from npm you may also need to install build tools:
This command will pull a “Development Tools” group with the applications needed to compile node.js.
To test an installation, run:
If you get an error saying ‘-bash: npm: command not found’, try the alternative method of installing Node.js by compiling from source.
Alternative: Compiling from Source
Note that this requires Python 2.6+ to use ./configure above. Otherwise, you’ll get an error like this:
To avoid that, run