Procedure to install Node.js 11.x on Ubuntu 16.x/18.x, CentOS 7.x through binary distribution or from the source.
Node.js popularity is growing faster than ever. If you recently started learning Nodejs development, then one of the first things you need to do is to install them.
Technically, there are multiple ways to get things installed but following the easy and right process will make life much easier.
The following, I’ve tested on DigitalOcean server. Let’s get it started.
The latest version of Nodejs is not available through the default repository. But not to worry, you can use NodeSource distribution as the following.
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
The above will download and install the NodeSource Node.js repository. At the end of the above output, you should see something like this.
Reading package lists... Done ## Run `sudo apt-get install -y nodejs` to install Node.js 11.x and npm ## You may also need development tools to build native addons: sudo apt-get install gcc g++ make ## To install the Yarn package manager, run: curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update && sudo apt-get install yarn
apt-get install -y nodejs
It will take a few seconds and once done; you should be able to verify the version.
root@geekflarelab:~# nodejs -v v11.7.0 root@geekflarelab:~#
And, as you can see, it has installed 11.7.0 version.
First, you need to install the NodeSource repository with the following command.
curl -sL https://rpm.nodesource.com/setup_11.x | bash -
And then, install the Nodejs as below.
yum install -y nodejs
It will take a few seconds, and at the end, you should see something like below.
Running transaction Installing : 2:nodejs-11.7.0-1nodesource.x86_64 1/1 Verifying : 2:nodejs-11.7.0-1nodesource.x86_64 1/1 Installed: nodejs.x86_64 2:11.7.0-1nodesource Complete! [root@geekflarelab ~]#
This means the Node.js is installed and can be verified with
[root@geekflarelab ~]# node -v v11.7.0 [root@geekflarelab ~]#
The above instruction should also work for Fedora 29 or later.
What if you are in a DMZ environment where you can’t connect to the Internet? You still can install by building the source code. The procedure is not as easy as above through binary distribution but doable.
wget. I am trying the latest one.
tar -xvf node-v11.7.0.tar.gz
drwxr-xr-x 9 502 501 4096 Jan 17 21:27 node-v11.7.0
And, its time to build the Node.js from source now.
But, before you proceed, ensure you have the pre-requisites installed.
If using Ubuntu then install the pre-requisites with below
apt-get update apt-get install gcc g++ clang make
and for CentOS
yum update yum install gcc clang gcc-c++
make make install
It will take some time to build and once done; you can verify the installed version by executing below.
root@geekflarelab:~# node --version v11.7.0 root@geekflarelab:~#
You see, installing Nodejs is easy. Nex, you may want to learn and understand Nodejs.
There are many short names used in Cloud Service Models, and sometimes it may be…
As a dashboard and reporting tool for the masses, Google Data Studio is consistently gaining…
The COVID-19 outbreak has disrupted the entire world, including millions of businesses. Many businesses have…
Every business should make video marketing an integral part of its strategy to stay on…
You’re leaving a lot of money on the table if you don’t create videos for…