How to Install Node.js on CentOS 7

The Problem

Today, I was testing the new Angular 4 Scripting Application sample provided by IBM as a starting point for creating Script Portlet based Apps. However, my development environment is a CentOS 7 computer, and I usually don’t work with Node.js in that computer, so here the simple steps to install Node.js in a CentOS 7 machine, let’s proceed:

The Solution

Since CentOS 7 uses RPM as the package manager by default (CentOS is basically the open version of Red Hat Enterprise Linux or RHEL), the easiest way to install Node.js is following the instructions in the official Node.js documentation.

Step 1. Download the installation binaries of the Node.js version you are interested in, in my case I wanted to have the latest stable version or long term support (LTS) which is version 8.x:

curl --silent --location | sudo bash -

Step 2. Proceed to install

sudo yum install -y nodejs

Step 3. Check the installation was successful

node --version

# You will see something like

If previous command gives you the Node.js version, you are all set. You also have npm so you can continue building awesome apps.

That’s it!

Hope you find this information useful, see you next time and remember be happy with your code.

Leave a Reply

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