Download the install & execute it
To install the latest version of Node.js we should download the installer and execute it.
If we don't know the latest version of Node.js we can check it at the website of the project https://nodejs.org.
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
Once the command has finished we should install Node.js using yum.
yum install -y nodejs
Check the installed version
Once we have Node.js installed we can check the current version using the next command.
node -v
Install dependencies
If at some point we need to compile a Node.js dependency for our system, like SQLite, we should install the following.
yum install gcc-c++ make
Update NPM
After installing Node.js it's possible to have an outdated version of NPM, to update it we should execute the following command.
npm install -g npm