Commands to install node.js on CentOS 6 & 7 servers

- Advertisment -
- Advertisement -

Node.JS is an open-source JavaScript runtime environment that runs JavaScript on the server-side. JavaScript is actually run only on the client, in your web browser, to perform certain actions. Node JS reverses the principle and runs the JavaScript code on the server, even before the data is sent to the client.

Node.JS Server-side JavaScript for dynamic web pages runs in the JavaScript runtime environment “V8”, originally developed for the Google Chrome browser. That’s why the Node has a resource-saving architecture that allows a large number of concurrent client connections.

Here in this tutorial, we will show the easiest way to install Node.js & NVM on a CentOS 7 server that is via Yum repository.

Installing Node.js on CentoS 7/6 via Epel Repository

Open command Terminal

If you are on CentOS 7/6 command-line interface server then simply move to next for issuing the NOde.js installation command. And for those are on GUI desktop, go to Applications, search for Terminal and open that.

Add Node.js Repository on CentOS

As Nodejs is not available to install from the default repo list of CentOS, thus, we need to add YUM Nodejs repository. From where we can easily pull its installation packages. Here is the command:

To install the latest version of Node.js

yum install -y gcc-c++ make
yum-config-manager --add-repo=https://rpm.nodesource.com/setup_12.x 

To install stable LTS Node.js version

yum install -y gcc-c++ make
yum-config-manager --add-repo=https://rpm.nodesource.com/setup_10.x

Note: Here we installing Nodejs LTS version that is 10.x

Update System to flush cache

yum -y update 

Install Node.js on CentOS 7/6

Finally, the YUM Node repo has been set up, its time to use the Node.js installation command on our CentOS server. The NPM will also automatically install along with Node.js using the below command:

sudo yum install nodejs

Check Node Version

The node installation is done, now check the version of the installed Node javascript to make which one you have and what do you require.

node --version

The output of the above command

[root@5266fecf435b ~]# yum install nodejs
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
nodesource | 2.5 kB 00:00:00
nodesource/x86_64/primary_db | 32 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:10.16.0-1nodesource will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
Package Arch Version Repository Size
========================================================================================================================
Installing:
nodejs x86_64 2:10.16.0-1nodesource nodesource 19 M

Transaction Summary
========================================================================================================================
Install 1 Package

Total download size: 19 M
Installed size: 56 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/nodesource/packages/nodejs-10.16.0-1nodesource.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 34fa74dd: NOKEY
Public key for nodejs-10.16.0-1nodesource.x86_64.rpm is not installed
nodejs-10.16.0-1nodesource.x86_64.rpm | 19 MB 00:00:15
Retrieving key from file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Importing GPG key 0x34FA74DD:
Userid : "NodeSource <gpg-rpm@nodesource.com>"
Fingerprint: 2e55 207a 95d9 944b 0cc9 3261 5ddb e8d4 34fa 74dd
Package : nodesource-release-el7-1.noarch (installed)
From : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : 2:nodejs-10.16.0-1nodesource.x86_64 1/1
Verifying : 2:nodejs-10.16.0-1nodesource.x86_64 1/1

Installed:
nodejs.x86_64 2:10.16.0-1nodesource

Complete!


[root@5266fecf435b ~]# node --version
v10.16.0

..

H2S Media Team
H2S is a group of tech enthusiasts those are passionate about latest technology developments. They always like to solve own technical problems and share the same solution with others through this Website.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Posts

4 Best Affordable Gaming Smartphone of 2020

The smartphone industry is rapidly expanding and this expansion is only going to increase at a very rapid rate....

AMANI introduces ASP-E1322 Explosive Earphones

AMANI recently has announced a brand new AMANI ASP-E1322 earphones in its wired audio products category. The launched product is...

SECUREYE launches S-F40 and S-C20 security & surveillance cameras

In India, the video surveillance market which is growing at 10.5% CAGR has already crossed Rs.5000 cr. Fuelled by...

4 Best Apps for Anger Management Issues for Android

It is true that technology has brought a drastic change in our lives and is continually doing so at...
- Advertisement -

Signs of Failing Hard drive that you should never ignore

The hard drive is undoubtedly one of the most important components of your computer, even though your computer cannot...

Prominent Edtech startups that are changing the way students learn

Education technology startups play a key role. Challenging the traditional education ecosystem, online education has now grown deep into...

- Advertisment -
- Advertisement -

You might also likeRELATED
Recommended to you