How to Install Node.js on Ubuntu, CentOS?

The best way to set up Node.js 11.x, 12.x, 14.x on Ubuntu 16.x/18.x, CentOS 7.x/8.x through binary distribution or from supply.

The recognition of Node.j is rising quicker than ever. In the event you’ve just lately began studying Nodejs improvement, one of many first issues it’s best to do is set up it.

Technically, there are a number of methods to get issues put in, however following the straightforward and proper course of will make life a lot simpler.

The next I’ve examined on the DigitalOcean server. Let’s begin.

Ubuntu 16.x or 18.x

The most recent model of Nodejs is just not obtainable via the default repository. However don’t be concerned, you should utilize the NodeSource distribution as follows.

  • Log in to the server as root
  • Do the next

To put in Node.js 11.x

curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -

To put in Node.js 12.x

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

To put in Node.js 14.x

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

The above will obtain and set up the NodeSource Node.js repository. On the finish of the above output it’s best to see one thing like this.

Studying bundle lists... Achieved

## Run `sudo apt-get set up -y nodejs` to put in Node.js 11.x and npm
## You might also want improvement instruments to construct native addons:
     sudo apt-get set up gcc g++ make
## To put in the Yarn bundle supervisor, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
     echo "deb https://dl.yarnpkg.com/debian/ secure predominant" | sudo tee /and many others/apt/sources.listing.d/yarn.listing
     sudo apt-get replace && sudo apt-get set up yarn
  • Then it is advisable set up the nodejs with the next command.
apt-get set up -y nodejs

It takes a couple of seconds and once you’re achieved; it’s best to have the ability to confirm the model.

root@geekflarelab:~# nodejs -v
v11.7.0
root@geekflarelab:~#

And as you may see, model 11.7.0 is put in.

CentOS/RHEL 7.x or 8.x

First it is advisable set up the NodeSource repository with the next command.

Set up Nodejs 11.x

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

Set up Nodejs 12.x

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

Set up Nodejs 14.x

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

After which set up the Nodejs as beneath.

yum set up -y nodejs

If you’re utilizing CentOS 8.x, it’s also possible to attempt DNF.

dnf set up -y nodejs

It should take a couple of seconds and finally it’s best to see one thing like beneath.

Working transaction
  Making ready        :                                                                                                                                                                1/1 
  Putting in       : python3-setuptools-39.2.0-5.el8.noarch                                                                                                                         1/4 
  Putting in       : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64                                                                                                            2/4 
  Working scriptlet: python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64                                                                                                            2/4 
  Putting in       : python3-pip-9.0.3-16.el8.noarch                                                                                                                                3/4 
  Working scriptlet: nodejs-2:14.9.0-1nodesource.x86_64                                                                                                                             4/4 
  Putting in       : nodejs-2:14.9.0-1nodesource.x86_64                                                                                                                             4/4 
  Working scriptlet: nodejs-2:14.9.0-1nodesource.x86_64                                                                                                                             4/4 
  Verifying        : python3-pip-9.0.3-16.el8.noarch                                                                                                                                1/4 
  Verifying        : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64                                                                                                            2/4 
  Verifying        : python3-setuptools-39.2.0-5.el8.noarch                                                                                                                         3/4 
  Verifying        : nodejs-2:14.9.0-1nodesource.x86_64                                                                                                                             4/4 

Put in:
  nodejs-2:14.9.0-1nodesource.x86_64       python3-pip-9.0.3-16.el8.noarch       python3-setuptools-39.2.0-5.el8.noarch       python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64      

Full!
[root@lab ~]#

Which means Node.js is put in and can be utilized to authenticate -v syntax.

[root@geekflarelab ~]# node -v
v11.7.0
[root@geekflarelab ~]#

The above instruction must also work for Fedora 29 or later.

Set up from supply code

What must you do if you’re in a DMZ setting the place you can not connect with the web? You’ll be able to nonetheless set up it by constructing the supply code. The process is just not so simple as above through binary distribution, however it’s doable.

  • Log in to the Ubuntu or CentOS server
  • Get the most recent or the one you need right here wget. I attempt the most recent.
wget https://nodejs.org/dist/v11.7.0/node-v11.7.0.tar.gz
  • Extract the downloaded file utilizing the tar command
tar -xvf node-v11.7.0.tar.gz
  • You must see a brand new folder created within the present workbook
drwxr-xr-x 9  502  501     4096 Jan 17 21:27 node-v11.7.0
  • Go to the folder you simply created
cd node-v11.7.0/

And it is time to construct the Node.js from supply now.

However earlier than you go any additional, be sure you have the conditions put in.

In the event you use ubuntu then set up the conditions beneath

apt-get replace
apt-get set up gcc g++ clang make

and for CentOS

yum replace
yum set up gcc clang gcc-c++
  • Let’s construct it now
./configure
  • Be sure that there isn’t a error after which subsequent
make
make set up

It should take a while to construct and when completed; You’ll be able to confirm the put in model by working beneath.

root@geekflarelab:~# node --version
v11.7.0
root@geekflarelab:~#

You see, putting in Nodejs is straightforward.

Subsequent, it’s possible you’ll wish to discover the Nodejs framework to change into knowledgeable programmer.

Leave a Comment

porno izle altyazılı porno porno