How to Install Node.js on CentOS 7

r00t August 18, 2017

Install Node.js on CentOS 7

In this tutorial we’ll learn how to install Node.js on CentOS 7. We will also install and configure its prerequisites. Node.js is an open source, cross-platform runtime environment for developing server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows, and Linux. Node.js also provides a rich library of various JavaScript modules which simplifies the development of web applications using Node.js to a great extent.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Node.js on CentOS 7

Step 1. First, ensure your system is fully up-to-date by running the following:

yum -y update

Step 2. Installing Node.js.

Run the commands below to install NPM and NodeJS on your CentOS Server:

curl -sL https://rpm.nodesource.com/setup_7.x | bash -

Then install Node.js and npm packages using yum:

yum -y install nodejs npm

Step 3. Verify Node.js Installation.

To verify the installed version you can do:

node --version

To output shall be:

[root@myvpsource.com ~]# node --version
v6.3.1

Install Node.js from source package

Step 1. First, install the development packages required for compiling Node.js source.

yum install gcc gcc-c++ make

Step 2. Download latest version of Node.js is available for download on https://nodejs.org/download/:

wget https://nodejs.org/dist/v5.3.0/node-v5.3.0.tar.gz
tar xzf node-v5.3.0.tar.gz
cd node-v5.3.0
./configure
make
make install

Check the version of Node.js using the following command:

node –version

Congratulation’s! You have successfully install and configured Node.js on your CentOS 7 server.

The Tags:

Leave a Comment

Comments are closed.