How To Install NPM, NodeJS and Angular On Linux

How To Install NPM, NodeJS, and Angular On Linux

We can install Nodejs, NPM latest version, and Angular CLI on Linux. First, we will have to install the nodejs and npm then we can install the Angular CLI. Let’s see, how to install nodejs. we can also install socket.io this is basically used to make a connection between the web clients and server on Linux.

We need to install the extra repository means epel-repository. we will also install few tools to compile and install packages which are dependencies. 

[root@node-js ~]# yum install epel-release -y
[root@node-js ~]# yum install gcc c++ make

Method 1: Install Nodejs Using Yum:

Once these are installed. we will install the Nodejs using the yum commands. This package is available in epel repository. 

[root@node-js ~]# yum install nodejs
[root@node-js ~]# node -v
v6.17.1
Install NPM Using Yum:
The Nodejs will automatically install the NPM package along with itself.
[root@node-js ~]# npm -v
3.10.10

Check Out: Error NOAUTH Authentication required while Accessing Redis

Method 2: Install the latest Nodejs Using repository:

We can also get the latest Nodejs using the repository. we have to add it to the server. we added the version 14 and then install it.

[root@node-js ~]# curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash -
[root@node-js ~]# yum install nodejs

Now we have the latest version of Nodejs.

[root@node-js ~]# node -v
v14.0.0
[root@node-js ~]# npm -v
6.14.4

If you need to install yarn, you can simply add the repository and then install it. 

[root@node-js ~]# curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
[root@node-js ~]# yum install yarn

Check Out: How To Create Elastic File System(EFS) On Amazon Cloud

Install Angular CLI:

We can install it using a single command. Once it’s downloaded the packages. 

[root@node-js ~]# npm install -g @angular/cli
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
/usr/bin/ng -> /usr/lib/node_modules/@angular/cli/bin/ng

> @angular/cli@9.1.3 postinstall /usr/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js

? Would you like to share anonymous usage data with the Angular Team at Google under
Google’s Privacy Policy at https://policies.google.com/privacy? For more details and
how to change this setting, see http://angular.io/analytics. Yes
+ @angular/cli@9.1.3
added 271 packages from 206 contributors in 63.654s

We will check the Angular version using the ng –version command. Angular CLI 9.1.3 installed.

install socket.io on linux

Check Out: How To Mount the Same Volume To Multiple Container In Docker

Install Socket.IO:

It’s a javascript library for realtime web applications. This enables realtime, bi-directional communication between web clients and servers. we can install it using npm command. There’s no separate package for it.

[root@node-js ~]# npm install socket.io

If you want to check the version, you can run the below command.

[root@node-js ~]# npm list socket.io
/root
`-- socket.io@2.3.0

If you need to update it, run the below command.

[root@node-js ~]# npm update socket.io

You’re done npm latest version install socket.io on linux

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment