Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  How-Tos  >  How to Install Angular CLI on CentOS/RHEL Versions: 8/7/6?
Top Scroll

How to Install Angular CLI on CentOS/RHEL Versions: 8/7/6?

 2 min

Angular is a framework used to build single-page client applications with the help of HTML and TypeScript. It monitors all the components and ensures that they are updated by checking for their updates regularly. In this tutorial, you will learn to install the Angular CLI tool on CentOS 8/7/6 and RHEL 8/7/6 Linux operating systems.

1. Installing Node.js

At first, install node.js on your system. Configure node.js yum repository in your CentOS system and install it using the below commands:

curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash -
sudo yum install nodejs

Ensure that node.js and NPM are successfully installed on your system with the below commands:

node --version
npm --version

2. Installing Angular/CLI

Once you install node.js and npm on your system, install the Angular CLI tool on your system by executing the below command:

npm install -g @angular/cli

With this, the latest available Angular CLI version will be installed on your system. For installing specific Angular version run command as below with version number.

npm install -g @angular/cli@6 #Angular 6
npm install -g @angular/cli@7 #Angular 7
npm install -g @angular/cli@8 #Angular 8
npm install -g @angular/cli@9 #Angular 9

The -g above command helps to install the Angular CLI tool globally. This makes it accessible to all users and applications on the system. Angular CLI offers a command ng for command-line operations. With this command, you can check the installed version of ng on your system.
ng --version

/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/

Angular CLI: 9.0.7
Node: 12.16.1
OS: linux x64

Angular:
...
Ivy Workspace:

Package Version
------------------------------------------------------
@angular-devkit/architect 0.900.7
@angular-devkit/core 9.0.7
@angular-devkit/schematics 9.0.7
@schematics/angular 9.0.7
@schematics/update 0.900.7
rxjs 6.5.3

3. Creating New Angular Application

You can also create a new application for example, hello-angular4 with the help of the Angular CLI tools. Run the following command for this:

ng new hello-angular

Output:

...
...
added 1011 packages from 1041 contributors and audited 19005 packages in 55.774s
found 0 vulnerabilities

Successfully initialized git.

With this, a directory named hello-angular4 will be created in your current directory along with an application.

4. Serving Angular Application

The basic Angular application is ready to serve. Now change the directory to hello-angular4 and run your Angular application with the ng serve command:

cd hello-angular
ng serve

Your angular application is now accessible on localhost port 4200, the default host and port used by Angular application.

http://localhost:4200

It is possible to change host and port for running Angular application by providing –host and –port command line arguments.

ng serve --host --port

In this way, you can install Angular CLI on CentOS/RHEL versions 8/7/6.

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.