How to install NodeJs on RHEL 7/Ubuntu/Linux ec2 instance

Follow the steps given below for setting up NodeJS on RedHat 7/Uubntu or Amazon Linux ec2 server.

  1. Update the repository.

For RHEL/Amazon Linux:

    sudo yum update -y

For Ubuntu:

    sudo apt-get update -y
  1. Install nvm

     curl -o- | bash
  2. Refresh the terminal

     source ~/.bashrc
  3. You can list the available node versions using the following command.

     nvm list
  4. Install the specific version of node using nvm.

     nvm install 6.9.2
  5. Test the installation by executing the following command.

     node --version