Home Ubuntu How to Install AngularJS on Ubuntu 22.04/20.04

How to Install AngularJS on Ubuntu 22.04/20.04

AngularJS is the extensible Javascript framework that plays well with your HTML without abstraction. The primary appeal of AngularJS is that it works like the dynamic component HTML never had. AngularJS simplifies the process of getting started with development especially if you have the prerequisite met.

With the lack of abstraction like other frameworks and fluid interoperability with HTML, AngularJS extends your control with features that include data binding, controller, and models based on plain javascript.

Additionally, AngularJS is bundled with features such as directives that enable you to invent your own HTML syntax that may be specific to any application you may be developing.

Secondly, AngularJS simplifies the management of complex DOM structures with the reusable component, and lastly, localization is advertised as one of the main features due to the ability to configure your app with aware filters with corresponding building blocks that make your app available in multiple locales.

Prerequisites

To install AngularJS on your Linux system, you need the following:

  • Node.js – an active LTS or maintenance LTS version.

Let’s get started…

Installing Node.js in Ubuntu

To install the latest version of Node.js on a Linux system, you need to install NVM (Node Package Manager), which is a command-line tool for installing and managing Node.js on a system.

To install the latest version of NVM using the following curl command.

$ curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 
Download NVM in Ubuntu
Download NVM in Ubuntu

Once installed, you can install multiple or any specific Node.js version on your system using the nvm command as shown.

$ nvm list-remote       [List Available Node Versions]
$ source ~/.bashrc      [Load Environment]
$ nvm install node      [Install Latest Node Version]
$ nvm install v16.14.1  [Install Specific Node Version]
Install NodeJS in Ubuntu
Install NodeJS in Ubuntu

Installing AngularJS in Ubuntu

After installing Node.js on your system, use the following command to install the latest version of the AngularJS tool on your system.

$ npm install -g @angular/cli
Install AngularJS in Ubuntu
Install AngularJS in Ubuntu

Once the install process is concluded, use the command below to determine the installed version.

$ ng version 
Check AngularJS in Ubuntu
Check AngularJS in Ubuntu

Creating New AngularJS Application in Ubuntu

Creating a test app will ensure that our installation is running on a designated local host port. In this case, we created an app called “hello-linux”.

$ ng new hello-world
Create AngularJS Application
Create AngularJS Application

The above command will create a hello-world directory with all the needed files for an application. Switch to the directory of your newly created app and run it using the commands below.

$ cd hello-linux
$ ng serve
Run AngularJS Application
Run AngularJS Application

Once started, you can access the application on port 4200 as shown.

http://localhost:4200

If you want, you can run the application on a specific port by adding --host and --port command-line options to the command as shown.

$ ng serve --host 0.0.0.0 --port 8080
Access AngularJS Application
Access AngularJS Application

AngularJS is extensive in functionality with support for Material UI and other nifty features that enrich your development experience. Head over to their official website, angularjs.org to learn more.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

2 thoughts on “How to Install AngularJS on Ubuntu 22.04/20.04”

  1. AngularJS” and “Angular” are not the same framework. In this article you use both terms to refer to “Angular“.

    Reply

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.