How Do You Install Npm and/or node.js on a AWS Instance of RHEL?

Problem scenario
Using a RHEL server in AWS, you try this command "npm -v", and it shows that npm is not installed.  You want to use the npm utility or you want Node.js to be installed on your RedHat version 7 Linux server in AWS.  You may have tried various yum commands but received errors about dependencies.  Various other scripts fail to get npm to be a recognized command.  How do you install npm and/or Node.js without changing yum repositories and without using the wget command?

Warning: This solution takes approximately 30 minutes, but it does not require interaction.  Do not try this solution on a sever with less than 1 GB of RAM. If you want extra swap space, you can see this posting. If you want to install npm on a different distribution of Linux, see this posting.

1.  Create a file named "" (with no quotes) with the following content:

#If version changes to 9, update the cd node-v8* command below
cd /opt/
curl$version/node-v$version.tar.gz > node-v$version.tar.gz
tar xzvf node-v$version.tar.gz

cd node-v8*
yum -y install gcc gcc-c++
make install

2.  Run the script with sudo bash with no quotes.

Leave a comment

Your email address will not be published. Required fields are marked *