How Do You Install npm and Node.Js on Any Distribution of Linux?

Problem scenario
You have Linux servers of different distributions (including Debian/Ubuntu, Red Hat derivatives such as CentOS, RHEL, or Fedora, and Linux SUSE).  You want to install npm and Node.js on them.  What do you do?

i.  You need a server with at least 1 GB of RAM.  To add virtual memory, see this posting.  To resize your GCP server, see this posting.  To upgrade your EC-2 instance (a VM running in AWS), see this posting.
ii.  Install the C compiler.  If you do not know how, see this posting.
iii. You have the make utility installed. If you need assistance, see this posting.

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

cd /opt/
curl > node-v14.1.0.tar.gz
tar xzvf node-v14.1.0.tar.gz && cd node-v14*
make install

2.  Run the script with "sudo bash" with no quotes.  This script may take over one hour to run.

Leave a comment

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