Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.
To gain access to the EPEL repo, you must modify the repo-list of your installation. Fortunately, we can reconfigure access to this repository by installing a package available in our current repos called epel-release.
The current LTS version of Node.js is version 10.x. If you want to install version 8 just change setup_10.x with setup_8.x in the command below.
Run the following curl command to add the NodeSource yum repository to your system:
sudo yum install epel-release curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
Now that you have access to the EPEL repository, you can install Node.js using your regular yum commands:
sudo yum install nodejs
Once again, you can check that the installation was successful by asking Node to return its version number:
node --version v10.13.0 npm --version 6.4.1