Install AngularJS in Ubuntu 22.04 | 20.04Linux

AngularJS is a development framework, 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, JavaScript-embedded development framework project. It contains a set of useful libraries for developing web applications and offers a set of design patterns to run them. In short, it is a Javascript language-based framework for developing frontend and backend web applications with client-side programming.

It is an MVC (Model-View-Controller) framework developed by Google for front-end web development that allows us to create SPAs (single-page applications) without anything going wrong. Using Model-View-Model separates the logic from the design logic but keeps the two parts connected (data binding). So the visual layer doesn’t know what’s going on in the logical 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 old PHP in our developments with modern technology.

Steps to Install AngularJS on Ubuntu 22.04 | 20.04Linux

The commands given here to configure 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 other similar Linux
A non-root user (sudo)
Terminal access
Internet connection

2. Install NodeJS and NPM on Ubuntu 22.04

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

As of writing this article, the latest version of NodeJs was 17. Hence, we are going for the same. You can check the latest version on its GitHub page.

Make sure curl is installed:

sudo apt install curl -y

Now add the NodeJs repository:

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

Command to install nodeJS

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

sudo apt install nodejs

3. Update NPM Package Manager

NPM automatically accompanies NodeJS on our system, but before moving forward, let’s make sure we have the latest version of it on our system.

sudo npm install [email protected] -g

Once you are sure that the version of NPM 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 it to download the packages to configure AngularJS on Ubuntu 22.04 Jammy or 20.04 Focal.

sudo npm install -g @angular/cli

5. Check the version of AngularJS

After the installation is complete, let’s check the Angular CLI version.

ng version

Install AngularJS on Ubuntu 22.04 20.04 LTS

5. Create your first Angular application 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 application directory is created with the required files, switch to this one:

cd myapp

Now run the given command to compile your application:

ng serve

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

http://localhost:4200

Well, if you want to run the application on another port and leave it accessible from any IP address, declare it before running the command:

Example:

ng serve --host 0.0.0.0 --port 8000

Conclusion:

This was the quick guide on how to install AgularJS on Ubuntu 22.04 and 20.04 Linux systems. To learn more about this Java-based development platform, see the official documents.

Other Items:

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


Source link

Steven L. Nielsen