• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Update and Manage Node.js version with n on CentOS 7.6

  • 00:34 yum install -y gcc-c++ make
  • 00:43 curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -
  • 00:53 yum install nodejs
  • 01:02 node -v
  • 01:08 npm -v
  • 01:22 npm install -g n
  • 01:23 n lts
  • 01:37 node -v
  • 01:45 n bin 10.15.3
  • 01:54 vim /etc/profile
  • 02:05 source /etc/profile
  • 02:14 n 10.15.3
  • 02:20 n prune
  • 02:24 node -v
5682

Installing, Updating and Managing Node.js with n

Pre-requisites:

Gcc-c++ and make

Download link :

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

Installation procedure of node.js

Install the development tools that are required to install the node.js.

[root@linuxhelp ~]# yum install -y gcc-c++ make
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Package 1:make-3.82-23.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 0:4.8.5-36.el7_6.2 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-36.el7_6.2 for package: gcc-c++-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: libstdc++ = 4.8.5-36.el7_6.2 for package: gcc-c++-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: gcc = 4.8.5-36.el7_6.2 for package: gcc-c++-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-c++-4.8.5-36.el7_6.2.x86_64
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-36.el7_6.2 will be installed
--> Processing Dependency: libgomp = 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: cpp = 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: libgcc >= 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-36.el7_6.2.x86_64
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
.
.
.
Dependency Installed:
  cpp.x86_64 0:4.8.5-36.el7_6.2                  gcc.x86_64 0:4.8.5-36.el7_6.2                    glibc-devel.x86_64 0:2.17-260.el7_6.5     
  glibc-headers.x86_64 0:2.17-260.el7_6.5        kernel-headers.x86_64 0:3.10.0-957.12.2.el7      libmpc.x86_64 0:1.0.1-3.el7               
  libstdc++-devel.x86_64 0:4.8.5-36.el7_6.2     

Dependency Updated:
  glibc.x86_64 0:2.17-260.el7_6.5              glibc-common.x86_64 0:2.17-260.el7_6.5            libgcc.x86_64 0:4.8.5-36.el7_6.2           
  libgomp.x86_64 0:4.8.5-36.el7_6.2            libstdc++.x86_64 0:4.8.5-36.el7_6.2              

Complete!

Add node.js yum repository and enable it in your system.

[root@linuxhelp ~]# curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -

## Installing the NodeSource Node.js 8.x LTS Carbon repo...


## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el7-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.2IYZWXWcQM' 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.2IYZWXWcQM'

## Cleaning up...

+ rm -f '/tmp/tmp.2IYZWXWcQM'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `sudo yum install -y nodejs` to install Node.js 8.x LTS Carbon and npm.
## You may also need development tools to build native addons:
     sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
     sudo yum install yarn

After the addition of yum repository to the system, install node.js package where npm will aslo be installed with node.js.

[root@linuxhelp ~]# yum install nodejs
Loaded plugins: fastestmirror, langpacks
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                                                                                         |  46 kB  00:00:01     
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:8.16.0-1nodesource will be installed
--> Finished Dependency Resolution
.
.
.

Warning: RPMDB altered outside of yum.
  Installing : 2:nodejs-8.16.0-1nodesource.x86_64                                                                                       1/1 
  Verifying  : 2:nodejs-8.16.0-1nodesource.x86_64                                                                                       1/1 

Installed:
  nodejs.x86_64 2:8.16.0-1nodesource                                                                                                        

Complete!

Check the version of node by running the following command

[root@linuxhelp ~]# node -v
v8.16.0

Check the version of npm by executing the following command.

[root@linuxhelp ~]# npm -v
6.4.1

You shall upgrade the node version by running the following command.

Install the node version manager n as follows

[root@linuxhelp ~]# npm install -g n
/usr/bin/n -> /usr/lib/node_modules/n/bin/n
+ n@4.1.0
added 1 package from 4 contributors in 0.758s

Upgrade the node version via n which installs a new version of a node under a folder managed by itself.

[root@linuxhelp ~]# n lts

     install : node-v10.15.3
       mkdir : /usr/local/n/versions/node/10.15.3
       fetch : https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.gz
######################################################################## 100.0%
   installed : v10.15.3

Check the version of node after the upgrading it.

[root@linuxhelp ~]# node -v
v8.16.0

Execute the command to know the system path

[root@linuxhelp ~]# n bin 10.15.3
/usr/local/n/versions/node/10.15.3/bin/node

Alter the system path in /etc/profile as follows:

[root@linuxhelp ~]# vim /etc/profile
# nodejs PATH
export NODE_HOME=/usr/local/n/versions/node/10.15.3/bin/node
export PATH=$NODE_HOME/bin:$PATH

Reset the profile by executing the following command

[root@linuxhelp ~]# source /etc/profile

Now,check the version of node.

[root@linuxhelp ~]# node -v
v10.15.3

Select the version of node that you want to keep by executing the following command

[root@linuxhelp ~]# n 10.15.3

Run the below command to remove the irrelevant packages in the version.

[root@linuxhelp ~]# n prune

With this, the method to install, upgrade and manage node.js using n on Centos 7.6 comes to end.

Tags:
jayce
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What can we do with nodejs?

A

you can build chat applications, control the car remotely, play pokemon. control a computer remotely, build your own hangouts and so on can be done using nodejs.

Q

IS nodejs frontend or backend?

A

node.js is a run time environment which lets users choose how to use, whether frontend or backend and one common language can be used as backend or frontend.

Q

Is nodejs better than JAVA?

A

Java will almost be faster than node.js because sharing memory amongst threads is a lot faster than the IPC

Q

What is nodejs best used for?

A

node.js is primarily used for non-blocking, event-driven servers, due to its single threaded nature. It's used for traditional web sites and back-end API services but was designed with real-time,push-based architectures in mind.

Q

What does n prune do in node.js management?

A

n prune removes the extraneous packages in node.js management.

Related Tutorials in How to Update and Manage Node.js version with n on CentOS 7.6

Related Tutorials in How to Update and Manage Node.js version with n on CentOS 7.6

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to Update and Manage Node.js version with n on CentOS 7.6

Related Forums in How to Update and Manage Node.js version with n on CentOS 7.6

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019
OpenVAS
frank class=
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Dec 20, 2018

Related News in How to Update and Manage Node.js version with n on CentOS 7.6

Related News in How to Update and Manage Node.js version with n on CentOS 7.6

Docker friendly Alpine Linux gets hardened Node.js
Docker friendly Alpine Linux gets hardened Node.js
Apr 19, 2017
JavaScript package manager npm removes malicious packages that were stealing data
JavaScript package manager npm removes malicious packages that were stealing data
Aug 5, 2017
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help legeek ?
Installation of the call center module

hello

I wish to install a call center in virtual with issabel, I downloaded the latest version of it , but I don' t arrive to install the call center module in issabel. please help me

thanks!

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.