Install Node.js on CentOS 7

Install Node.JS on CentOS 7


What is node.js?

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.


To install node.js we will need the following:

  • Node.js source downloadable from
  • a SSH client either putty or bitvise
  • root access to our vps server from

Once all is ready we can now start install node.js on our server.

Installing node.js from NVM

NVM or Node Version Manager is a piece of software that allows you to install and maintain many different independent versions of node.js and their associated node packages.

before we can install node.js on our machine we need to download and install NVM from GitHub. We can do this by the command.

curl | bash

This will install nvm version 0.13.1 but we will need to use first our bash_profile to use nvm.

source ~/.bash_profile

Then we run nvm to get a list of node version available for installation.

nvm list-remote

You will see the list like below:


You can install a version by typing nvm install and the version you need, for example.

nvm install v6.3.1

To install another version, type the above commands again with a differnet version at the end.

You can see which versions you have installed by typing:

nvm list

The result would be:

[root@node ~]# nvm list
->    v6.3.1

To switch between versions you can do.

nvm use v6.3.1

The result would be:

[root@node ~]# nvm use v6.3.1
Now using node v6.3.1

To set a version as default you can execute.

nvm alias default v6.3.1

the corresponding result shall be:

[root@node ~]# nvm alias default v6.3.1
default -> v6.3.1

Installing node.js from Epel Repository

An alternative method of installing node.js is from the Epel Repository that is available for CentOS and other linux distro's. To get access to the repo you must first install the epel-release by.

sudo yum install epel-release

Press y for yes and let it install.

After that you can just install node.js from yum.

sudo yum install nodejs

To verify the installed version you can do.

node --version

To output shall be:

[root@node ~]# node --version

Installing node.js from Source

One way of acquiring Node.js is to obtain the source code and compile it yourself.

To do so, you should grab the source code from the project's website. On the downloads page[1], right click on the "Source Code" link and click "Copy link address" or whatever similar option your browser gives you.

The current release version that node.js has is v6.3.1. We will download it using wget.


Then we will extract the source archive.

tar xvf node-v6.3.1.tar.gz

And enter the source folder.

cd node-v6.3.1

Then we will need to install some packages in order to compile the source.

sudo yum install gcc gcc-c++

After all the dependencies are installed we ca now compile and install node.js.


When make is complete you can install node.js using the command.

make install

All is done! Now you can make your scalable network application in the fastest time possible thanks to node.js!


comments (1)

  • wileysegovia

    - 6 years ago

    What year is this tutorial from? Important because of version numbers, etc.