Website Vidya
DevelopmentStep-by-Step Guide

How to Install Angular on Ubuntu: 5 Easy Steps

Angular is a TypeScript/JavaScript-based open-source mobile and desktop web application framework created by the Angular team at Google. It is a complete rewrite from the same team that built AngularJS. It is well suited for building small ...

RR
Website Vidya TeamLead Systems Educator
Published:
4 min read
How to Install Angular on Ubuntu: 5 Easy Steps
AI Executive SummaryCORE CIS AI

4 min read

Angular is a TypeScript/JavaScript-based open-source mobile and desktop web application framework created by the Angular team at Google. It is a complete rewrite from the same team that built AngularJS. It is well suited for building small ...

Key Highlights
  • Prerequisites
  • How to Install Angular on Ubuntu Server in 5 Simple Steps
  • Conclusion
Grounded in full engineering runbookCORE CIS Ai Engine

Angular is a TypeScript/JavaScript-based open-source mobile and desktop web application framework created by the Angular team at Google. It is a complete rewrite from the same team that built AngularJS. It is well suited for building small to large scale mobile and web applications from scratch. In this guide, we will learn how to install Angular on Ubuntu.

Prerequisites

Updating System Packages

It is always recommended that you have the latest packages updated on your server. To update the system packages, run:

sudo apt-get update && sudo apt-get upgrade

How to Install Angular on Ubuntu Server in 5 Simple Steps

Step #1: Install Node.js

First of all, you need to install Node.js on your server. Node.js is one of the most popular and beloved web technologies today. It is used by many web developers to increase the functionality of the mobile and desktop web application.

If you already have Node.js installed on your server, you can skip to the next step.

To install Node.js, use the following set of commands to add node.js PPA in your Ubuntu server.

sudo apt install python-software-properties
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs

You will also need to install npm, the Node.js package manager. You can do this by typing:

sudo apt install npm

Run the following command and make sure you have successfully installed Node.js and NPM on your server.

node --version
npm --version

Step #2: Install Angular/CLI

In this step, we will install an Angular/CLI tool on our server. We will install the Angular/CLI with the help of the Node Package Manager (NPM) that we installed earlier in the first step.

npm install -g @angular/cli

Once you hit enter, the latest version of Angular/CLI will be installed on your server. If you are looking to install some other version of Angular/CLI, you can specify the Angular version. For example:

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

In the command aboveĀ -gĀ stands for global. So if you includeĀ -gĀ in your command, then the Angular/CLI will be installed globally. Which means, it will be accessible to the all users and applications present on your server.

Angular/CLI provides you a commandĀ ng. It helps you to manage command-line operations. So let’s check the installed version ofĀ ngĀ on your server by typing:

ng --version
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / ā–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 9.0.5
Node: 12.16.1
OS: linux x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.5
@angular-devkit/core         9.0.5
@angular-devkit/schematics   9.0.5
@schematics/angular          9.0.5
@schematics/update           0.900.5
rxjs                         6.5.3

Checkout the official page forĀ CLI Overview and Command Reference.

Step #4: Creating new Angular Project

Let’s create a new Angular project by the nameĀ test-project. To create that, run the following command:

ng new test-project

Output:

.....
...... 
added 1167 packages from 1048 contributors and audited 19053 packages in 72.14s
23 packages are looking for funding
Ā  run `npm fund` for details
found 0 vulnerabilities
Ā Ā Ā  Successfully initialized git.

Step #5: Running Angular Application

Now navigate to theĀ test-projectĀ and run the application usingĀ ng serveĀ command:

cd test-project
ng serve

Once you run the command, your Angular application gets launched on the defaultĀ port 4200.http://localhost:4200

You can also change the host and port for your 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 can be accessed publicly.

For more information related to theĀ ngĀ tool, run the following command.

ng help

You may also like:

Conclusion

You have successfully installed an Angular/CLI on Ubuntu and created a test application.

I hope you will find this tutorial on how to install Angular on Ubuntu useful. Do share your views in the comment section below.

Written by

Website Vidya Team

Technology educator and researcher at Website Vidya.

Discussion

0
Share your thoughts, ask a question, or suggest a tip...
Write →

No comments on this guide yet. Be the first to share your thoughts or ask a question!

Recommended Reading10 Guides

Related Technical Guides

Tested runbooks, server administration walkthroughs, and troubleshooting guides

Development•

How to Install Python and Pip on Ubuntu 24.04 LTS

Python is one of the most popular, versatile, and widely-used programming languages today, underpinning everything from web development and automation to data science and artificial intelligence. Pip is Python’s official package manager, al...

RR
Rajesh Rai
Read More
Development•

How to Install Python on Ubuntu 24.04 LTS

Python is one of the most popular programming languages today, widely used in web development, data science, machine learning, automation, and more. Ubuntu 24.04 LTS (Long Term Support) comes with Python pre-installed, but often you might w...

RR
Rajesh Rai
Read More
Development•

How to Convert HTML to PDF in Java: 3 Easy Steps

Converting HTML to PDF is a common requirement in many Java applications, such as generating reports, invoices, or any other printable documents. PDFs are universally accepted and provide a professional look for documents. This article will...

RR
Rajesh Rai
Read More