How to install NodeJs on Linux Centos 7x

Prerequisites Before continuing with this tutorial, make sure you are logged in as a user […]


Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.

Install NodeJs from Source Code

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, right-click on the “Source Code” link and click “Copy link address” or whatever similar option your browser gives you.

On your server, use wget and paste the link that you copied in order to download the archive file:


There are a few packages that we need to download from the CentOS repositories in order to compile the code. Use yum to get these now:

sudo yum install gcc gcc-c++

Now, we can configure and compile the software:


The compilation will take quite awhile. When it is finished, you can install the software onto your system by typing:

sudo make install

To check that the installation was successful, you can ask Node to display its version number:

node --version

If you see the version number, then the installation was completed successfully.

Install Node from the EPEL Repository

An alternative installation method uses the EPEL (Extra Packages for Enterprise Linux) repository that is available for CentOS and related distributions.

To gain access to the EPEL repo, you must modify the repo-list of your installation. Fortunately, we can reconfigure access to this repository by installing a package available in our current repos called epel-release.

sudo yum install epel-release

Now that you have access to the EPEL repository, you can install Node.js using your regular yum commands:

sudo yum install nodejs

Once again, you can check that the installation was successful by asking Node to return its version number:

node --version

Many people will also want access to npm to manage their Node packages. You can also get this from EPEL by typing:

sudo yum install npm


As you can see, there are quite a few different ways of getting Node.js up and running on your CentOS 7 server. If one of the installation methods is giving you problems, try one of the other options.

Leave a Reply