How to Install on CentOS / RHEL 7/6 Angular CLI

Step 1 - Installation Node.js.

First, you need to install node.js. use the following set of commands on the system to add node.js PPA to your Ubuntu system and install it.

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

Make sure that the system is successfully installed on node.js and NPM

node --version
npm --version

Step 2 - Installation Angular / CLI

After installing and npm node.js on the system, using the following command Angular cli tool mounted on the system.

npm install -g @angular/cli

-G above command will use the global install Angular CLI tool. Therefore, all users and applications on the system can access it. Angular CLI commands to provide command line operation. Let's check ng version installed on your system.

the --version


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


Angular CLI: 8.0.4
Node: 12.4.0
OS: linux x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.800.4
@angular-devkit/core        8.0.4
@angular-devkit/schematics  8.0.4
@schematics/angular          8.0.4
@schematics/update          0.800.4
rxjs                        6.4.0

Step 3 - Create a new Angular application

Now, using Angular CLI tool to create a new application called hello-angular4 of. Execute commands to do this:

A new $ hello-angular

Output:

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

    Successfully initialized git.

This will create a directory named hello-angular4 in the current directory, and create an application.

Step 4 - Serve Angular Applications

Your basic Angular application is ready. Change directory to hello-angular4 Angular and run applications that use ng serve command.

$ cd hello-angular
$ serve the

You can access the application point on localhost port 4200, which is the default host and port Angular used by the application.

http://localhost:4200

You can change the host and port applications running Angular by providing -host and -port command-line parameters.

$ 0.0.0.0 of serve --host --port 8080

IP address 0.0.0.0 listening on all interfaces and is publicly accessible.

Guess you like

Origin www.linuxidc.com/Linux/2019-07/159521.htm