Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to Install Angular CLI on CentOS/RHEL 8/7/6

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

    By RahulMarch 25, 20203 Mins Read

    Angular is an frameworks, libraries, assets, and utilities. It keeps track of all the components and checks regularly for their updates. This tutorial will help you to install the Angular CLI tool on CentOS 8/7/6 and RHEL 8/7/6 Linux operating systems.

    Advertisement

    Step 1 – Install Node.js

    First of all, you need to install node.js on your system. Use the following set of commands to configure node.js yum repository in your CentOS system and install it.

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

    Make sure you have successfully installed node.js and NPM on your system

    node --version
    npm --version
    

    Step 2 – Install Angular/CLI

    After installation of node.js and npm on your system, use the following commands to install the Angular CLI tool on your system.

    npm install -g @angular/cli
    

    This will install the latest available Angular CLI version on your system. To install specific Angular version run command as following with version number.

    npm install -g @angular/[email protected]6     #Angular 6
    npm install -g @angular/[email protected]7     #Angular 7
    npm install -g @angular/[email protected]8     #Angular 8
    npm install -g @angular/[email protected]9     #Angular 9
    

    Using the -g above command will install the Angular CLI tool globally. So it will be accessible to all users and applications on the system. Angular CLI provides a command ng used for command-line operations. Let’s 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
    

    Step 3 – Create New Angular Application

    Now, create a new application named hello-angular4 using the Angular CLI tools. Execute the commands to do 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.
    

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

    Step 4 – Serve Angular Application

    Your basic Angular application is ready to serve. Change directory to hello-angular4 and run your Angular application using ng serve command.

    cd hello-angular
    ng serve
    

    You can access your angular application on localhost port 4200, Which is the default host and port used by Angular application.

    • http://localhost:4200

    You can change host and port for running Angular application by providing –host and –port command line arguments.

    ng serve --host 0.0.0.0 --port 8080
    

    The IP address 0.0.0.0 listens on all interfaces and publically accessible.

    Angular Angular-cli Angularjs centos
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to List Manually Installed Packages in Ubuntu & Debian

    10 Bash Tricks Every Developer Should Know

    How to Validate Email Address in JavaScript

    View 3 Comments

    3 Comments

    1. Craig Heartwell on May 28, 2020 12:18 pm

      this seems to install such that everything thereafter requires sudo – not acceptable. but since yum requires sudo, how do we fix this? Also does not work completely (at least on my clean RHEL7 server). npm then requires both sudo and overrides such as: sudo npm install -g @angular/cli –unsafe-perm=true

      end result is unusable root-only installs

      Reply
    2. Giri on March 6, 2020 11:54 am

      npm install -g @angular/cli this command taking latest version of angular but i need angular 6 in sysytem.

      Reply
      • Rahul on March 6, 2020 12:34 pm

        Hi Giri, use the command as:

        npm install -g @angular/[email protected]
        
        Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.