You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

This guide aims at guiding you install the latest Nodejs and npm on major Linux distributions – CentOS 7, Ubuntu 16.04 and Arch Linux. Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code on the server-side.

Node.js is built on Chrome’s V8 JavaScript engine and it uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

nodejs installation

Node.js applications can run on macOS, Linux, Microsoft Windows, and Unix servers.  These applications can also be written with CoffeeScript, which is a JavaScript alternative.

Install Node.js on CentOS 7

Node.js for CentOS 7 is available from the NodeSource Enterprise Linux repository. The official support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions. As of this writing, the latest release of Node.js is 9.

Install it on CentOS 7 by running the following commands:

curl --silent --location | sudo bash -
sudo yum install gcc-c++ make
sudo yum -y install nodejs

You can also use EPEL to download Node.js package. For Fedora,  Node.js and npm packages are available in Fedora 18 and later. Install with the command:

$ sudo dnf install nodejs

Install Node.js on Ubuntu 16.04

For Ubuntu and Debian systems, you can install Node.js v9 from the NodeSource repository. Use the commands:

$ curl -sL | sudo -E bash -
$ sudo apt-get install -y nodejs

Install Node.js on Arch Linux

Node.js for Arch Linux is available from its official upstream repositories. You only need to fire Pacman command with the package name as nodejs and the package should be installed.

$ sudo pacman -S nodejs

Install Node.js on macOS

To install Node.js on macOS, there are two different ways to get it. The first and quick method is by using bash shell.

curl "${VERSION:-$(wget -qO- | sed -nE 's|.*>node-(.*)\.pkg</a>.*|\1|p')}.pkg" > "$HOME/Downloads/node-latest.pkg" && sudo installer -store -pkg "$HOME/Downloads/node-latest.pkg" -target "/"

An alternative method is by using Homebrew:

$ brew install node

If you want to upgrade, run

$ brew upgrade node

Checking Node.js Installed Version

To check the version of Node.js installed on your system, use the command.

$ node -v

You should now be ready to start your Project with Node.js.

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF


Please enter your comment!
Please enter your name here