install node js on centos

How to install Node JS in CentOS-7

Welcome back to shortlearner.com, in our previous post we learn how to install Apache Web server on CentOS.
today in this post we will see How to install Node JS in CentOS-7.
so before start this tutorial we take an overview about Node JS and CentOS.

What is CentOS

CentOS is a Community Enterprise Operating System. It is an open-source platform for non-productive developmental work.
For production concern, those works can be migrated to RHEL (Red Hat Enterprise Linux) Linux distribution platform.

install node js on centos

What is Node JS

The Node.js platform is a server-side runtime environment based on JavaScript.
Node.js is a super-fast, high-performance and lightweight framework, ideal for asynchronous programming. With Node.js you are able to execute multiple actions at the same time.
so basically Node JS is a platform where developers can use JavaScript for backend development.

Also Read
How to Install phpMyAdmin on CentOS 7 – Google Cloud

Before Installation

Before the installation process of Node JS make sure you have already installed these below stuff.

Apache Web Server  – We need to install Apache! Check out our article Install Apache on CentOS 7.
PHP  – Then we need to install PHP! Check out our article Install PHP on CentOS.
MySQL  – Then we need to install MySQL! Check out our article Install MySQL on CentOS 7.
follow the below steps for installation od node.js

Step 1: VM Setup

so in the very first step logged in to your google cloud account and select the Compute Engine option from the menu.
follow the below image for better understanding.
Now we can see VM instances in Compute Engine. Click on that as shown in below image

google cloud VM instance

so we just click on the open in browser window and than we will see terminal there. follow the below commands on the terminal.

Step2: Add Yum Repository

so before adding this repository we should know about what is Yum Repository.

YUM (Yellowdog Updater Modified) is an open-source command-line that creates, maintains, updates, removes and manages a high-quality set of packages on CentOS.

yum install -y gcc-c++ make

Step 3: Build native add-ons:

after installation of YUM repository ,we have to install native add-ons from NPM We will install a compiler.

The latest version of Node.js

curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash –

The stable version of Node.js

curl -sL https://rpm.nodesource.com/setup_10.x | sudo -E bash –

Step4:Install Node.js

Now are having the packages of Node.js and NPM. We can install the Node.js package using the following command.
By executing below command, Node.js and NPM packages both will get install.

sudo yum install nodejs

After installation of Node.js

Step1:Testing Node.js

To check the installation of Node.js, we need to execute the below command. This will display you the version we installed.

node -v

Step2:Testing NPM

To check the installation of NPM, we need to execute the below command. This will display you the version of NPM we installed.

npm -v

So finally we learn the installation process of Node JS on CentOS 7.