Categories: Uncategorized

How to Install Angular on Ubuntu (18.04 & 16.04)

Angular is a TypeScript-based, open-source web application framework led by the Angular Team at Google. Angular is a complete rewrite from the team that built AngularJS.

Pre-requisites

First of all, you need to install node.js on your system. If you don’t have node.js installed use the following set of commands to add node.js PPA in your Ubuntu system and install it.

Step 1 – Install Node.js

In the below commands node 12 version will be installed to know more about other versions refer link

sudo apt install python-software-properties
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs
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

The -g flag will install the Angular CLI tool globally so that it will be accessible to all users and applications on the system.

The latest version of Angular CLI will be installed on your Ubuntu Linux system. You may require older Angular version on your machine. To install specific Angular version run command as following with version number.

npm install -g @angular/cli@6     #Angular 6
npm install -g @angular/cli@7     #Angular 7
Step 3 – Check Angular/CLI version

To verify the installation, check the version of Angular installed in your system using the ng command in Angular CLI:

ng --version
Step 4 – Create a 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
Step 5 – Serve Angular Application
cd hello-angular
ng serve

After compilation 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

 

Share

Recent Posts

Install Node.js in Ubuntu

Installation instructions Node.js v14.x: [crayon-6637ba43040e2052212991/] Node.js v13.x: [crayon-6637ba43040ec849323900/] Node.js v12.x: [crayon-6637ba43040ef641407845/] Node.js v10.x: [crayon-6637ba43040f1833804688/] Node.js…

4 years ago

Angular CLI & Troubleshooting

You encountered issues during the installation of the CLI or setup of a new Angular…

5 years ago

What is the difference between one-way binding and two-way binding ?

In One-Way data binding, view (UI part) not updates automatically when data model changed. We…

5 years ago