Install AngularJS in Ubuntu 22.04 | 20.04 Linux

AngularJS is a framework for development, here we learn the commands to install AngularJS on Ubuntu 22.04 Jammy JellyFish or Ubuntu 20.04 LTS Focal Fossa using Terminal.

What is AngularJS? 

AngularJS is an open-source development framework project, with built-in Javascript. It contains a set of useful libraries for developing web applications and proposing a set of design patterns to run them. In short, it is a so-called Javascript language-based framework for both frontend and backend web app development with client-side programming.

It’s an MVC (Model-View-Controller) framework developed by Google for front-end web development that allows us to build SPA (single-page applications) without anything going wrong. By using Model-View-Model, one separates the logic from the design logic but keeps both parts connected (data binding). So the visual layer doesn’t know what’s going on in the logic layer, but retains control of the DOM (the body of the web) and updates its content as desired. Compared to other options such as jQuery, Knockout, Handlebars, or PagerJs, Angular integrates a complete solution that allows us to abandon the old PHP in our developments with modern technology.

Steps to install AngularJS on Ubuntu 22.04 | 20.04 Linux

The commands given here to set up AngularJS will be the same for other Debian or Ubuntu-based operating systems. Such as Linux Mint, POP OS, MX Linux, and others…

1. Requirements

To follow this tutorial, we need:

Ubuntu and other similar Linux
A non-root (sudo) user
Terminal Access
Internet connection

2. Install NodeJS and NPM on Ubuntu 22.04

We can easily get AngularJS using the NPM package manager of NodeJS, hence install it first on your Ubuntu 22.04 or 20.04 Linux you are using with the help of the given command.

While doing this article, the latest version of NodeJs was 21. However, the latest LTS-supported version of Node by Angular is 16.x or 18.x while writing this article. You can check out the latest version on its GitHub page.

Make sure you have curl, installed:

sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

Now, add the NodeJs repository:

NODE_MAJOR=18
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt update

Command to Install nodeJS

Once you have added the repository, let’s use the APT package manager to install NodeJS and NPM:

sudo apt install nodejs
Add NodeJS Debian repository

3. Update NPM package manager

NPM comes along with NodeJS automatically on our system but before moving forward, let’s sure that we have the latest version of it on our system.

sudo npm install npm@latest -g

Once you are sure that the NPM version is up to date, we can check the version of NodeJS and NPM using the given commands:

npm -v
nodejs -v

4. Install AngularJS on Ubuntu 22.04 | 20.04 LTS

Now, we have the NPM on our Ubuntu Linux, let’s use the same to download the packages for setting up AngularJS on Ubuntu 22.04 Jammy or 20.04 Focal.

sudo npm install -g @angular/cli

5. Check the version of AngularJS

Once the installation is completed, let’s check the Angular CLI version.

ng version
Install AngularJS on Ubuntu 22.04 20.04 LTS

5. Create your first Angular App on Ubuntu 22.04 | 20.04

Well, we have AngularJs on our Linux system. Let’s test it by creating our first demo web application using its command line.

ng new myapp

Your App directory is created with the required files, switch to that:

cd myapp

Now, run the given command to compile your app:

ng serve

The above command will compile and run the applicant on the 4200 port. To access the app, open your browser and point it to:

http://localhost:4200

Well, if you want to run the application on some other port and let it be available to access from any Ip-address, declare the same before running the command:

Example:

ng serve --host 0.0.0.0 --port 8000
Steps to install AngularJS on Ubuntu 22.04 20.04 Linux

Conclusion:

This was a quick guide to AgularJS installation on Ubuntu 22.04 and 20.04 Linux systems. To know more about this Java-based development platform, refer to the official documentation.

Other Articles:

2 ways to install LAMP server on Ubuntu 22.04 | 20.04
How to install QEMU/KVM on Ubuntu 22.04 
Install Timeshift on Ubuntu 22.04

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.