Website Vidya
How-To GuidesStep-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
Rajesh RayLead 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.

Advertisement

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:

Advertisement
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:

Advertisement
.....
...... 
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.

RR
Written byVerified Author

Rajesh Ray

I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.

SPAM-FREE MODERATED DISCOURSE

Join the Conversation & Perspective

Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.

AT
MP
JV
+2

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

Featured Infrastructure PartnerUp to 75% OFF + 3 Months Free

Supercharge Your Linux & Cloud Workloads with Hostinger

Deploy high-speed NVMe KVM VPS, Docker containers, and LiteSpeed-accelerated WordPress servers in under 60 seconds with full root access, dedicated IPv4, and 24/7 technical support.

Pure NVMe SSD StorageFull Root Access & SSHFree Domain & Unlimited SSL99.9% Uptime SLA
Plans from$2.99/mo
Claim Hostinger DealAffiliate link • Special discount applied at checkout