Install Angular CLI on Linux Ubuntu. Angular CLI is a command line interface for Angular. The Angular CLI tool lets you initialize, develop, scaffold, and maintain Angular applications. You can use the tool directly in a command shell, or indirectly through an interactive UI such as Angular Console.
Install Angular CLI on Linux Ubuntu
Step 1 – Install Node.js
First of all, you need to install node.js on your system. Use the following set of commands to add node.js PPA in your Ubuntu system and install it.
Step 1.1 – Install Node.js version 12
sudo apt-get install python-software-properties
$ sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash
$ sudo apt install -y nodejs
$ sudo apt install -y build-essential
Step 1.2 – Install Node.js version 11
sudo apt-get install python-software-properties
$ sudo curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash
$ sudo apt install -y nodejs
$ sudo apt install -y build-essential
Step 1.3 – Install Node.js version 10
sudo apt-get install python-software-properties
$ sudo curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash
$ sudo apt install -y nodejs
$ sudo apt install -y build-essential
Step 2 – Install Angular/CLI
After installation of node.js and npm on your system, use following commands to install Angular cli tool on your system.
npm install -g @angular/cli
Using the -g above command will install the Angular CLI tool globally. So it will be accessible to all users and application 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
Create Angular Project Using Angular CLI
ng new my-dream-app
cd my-dream-app
ng serve
In your browser, open http://localhost:4200/ to see the new app run. When you use the ng serve command to build an app and serve it locally, the server automatically rebuilds the app and reloads the page when you change any of the source files.
Please Note
When you run ng new my-first-project a new folder, named my-first-project, will be created in the current working directory. Since you want to be able to create files inside that folder, make sure you have sufficient rights in the current working directory before running the command.
If the current working directory is not the right place for your project, you can change to a more appropriate directory by running cd first.
Online Help
Online help is available on the command line. Enter the following to list commands or options for a given command (such as generate) with a short description.
ng help
ng generate --help