Install AngularJS on Ubuntu 22.04

This article is going to take you through on how to Install AngularJS on Ubuntu 22.04. AngularJS is a JavaScript framework developed by Google for building dynamic web applications. It allows you to utilize HTML as your template language and enhance HTML’s syntax to represent the components of your application clearly and succinctly. Data binding and dependency injection in AngularJS eliminate a lot of the code you’d have to write and because it all happens in the browser, it’s a great companion for any server technology.

How to Install AngularJS on Ubuntu 22.04

In order to install AngularJS on your system, you need to have package manager installed. Common package managers are yarn and npm. We will use npm(node package manager) in this guide, to use npm you will be required to install nodejs. At the time of writing this article the latest node js version with long term support (LTS) is version 16. In case you are from the future, navigate to node js download page and check the latest version.

Install NodeJS On Ubuntu 22.04

  • Start by adding Node.JS repository using the command below.
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
  • Next run the following command to install Nodejs on Ubuntu 22.04.
sudo apt install nodejs

Sample output

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
Need to get 26.2 MB of archives.
After this operation, 122 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_16.x focal/main amd64 nodejs amd64 16.14.1-deb-1nodesource1 [26.2 MB]
Fetched 26.2 MB in 12s (2,185 kB/s)                  
Selecting previously unselected package nodejs.
(Reading database ... 228021 files and directories cur
rently installed.)
Preparing to unpack .../nodejs_16.14.1-deb-1nodesource
1_amd64.deb ...
Unpacking nodejs (16.14.1-deb-1nodesource1) ...
Setting up nodejs (16.14.1-deb-1nodesource1) ...
Processing triggers for man-db (2.9.1-1) ...
  • Check the version of nodejs installed using the command below.
 node -v

Install AngularJS on Ubuntu 22.04

  • After installing node package manager, you can now use it to install AngujarJS. Run the following command to install.
sudo npm install -g @angular/cli
  • Check AngularJS version installed using the command below.
ng version

Sample output

   _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.3.0
Node: 16.14.1
Package Manager: npm 8.5.4
OS: linux x64

Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1303.0 (cli-only)
@angular-devkit/core         13.3.0 (cli-only)
@angular-devkit/schematics   13.3.0 (cli-only)
@schematics/angular          13.3.0 (cli-only)

Create AngularJS Application on Ubuntu 22.04

  • Use the command below to create a new AgularJS application on ubuntu 22.04.
ng new itnixprodemo

Sample output

? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE itnixprodemo/README.md (1066 bytes)
CREATE itnixprodemo/.editorconfig (274 bytes)
CREATE itnixprodemo/.gitignore (548 bytes)
CREATE itnixprodemo/angular.json (3075 bytes)
CREATE itnixprodemo/package.json (1075 bytes)
CREATE itnixprodemo/tsconfig.json (863 bytes)
CREATE itnixprodemo/.browserslistrc (600 bytes)
CREATE itnixprodemo/karma.conf.js (1429 bytes)
CREATE itnixprodemo/tsconfig.app.json (287 bytes)
CREATE itnixprodemo/tsconfig.spec.json (333 bytes)
CREATE itnixprodemo/.vscode/extensions.json (130 bytes)
CREATE itnixprodemo/.vscode/launch.json (474 bytes)
CREATE itnixprodemo/.vscode/tasks.json (938 bytes)
CREATE itnixprodemo/src/favicon.ico (948 bytes)
CREATE itnixprodemo/src/index.html (298 bytes)
CREATE itnixprodemo/src/main.ts (372 bytes)
CREATE itnixprodemo/src/polyfills.ts (2338 bytes)
CREATE itnixprodemo/src/styles.css (80 bytes)
CREATE itnixprodemo/src/test.ts (745 bytes)
CREATE itnixprodemo/src/assets/.gitkeep (0 bytes)
CREATE itnixprodemo/src/environments/environment.prod.ts (51 bytes)
CREATE itnixprodemo/src/environments/environment.ts (658 bytes)
CREATE itnixprodemo/src/app/app-routing.module.ts (245 bytes)
CREATE itnixprodemo/src/app/app.module.ts (393 bytes)
CREATE itnixprodemo/src/app/app.component.css (0 bytes)
CREATE itnixprodemo/src/app/app.component.html (23364 bytes)
CREATE itnixprodemo/src/app/app.component.spec.ts (1091 bytes)
CREATE itnixprodemo/src/app/app.component.ts (216 bytes)
✔ Packages installed successfully.
    Successfully initialized git.
  • After installing, navigate to the installation folder.
cd itnixprodemo
  • Next compile and run you app using the command below.
ng serve
  • By default Angular development server listens on port 4200. Open your favorite browser and enter the URL localhost:4200 to access your Angular app.
  • In case you want Angular application to run on specific host and port for any reasons like port coalition etc. specify using the command below.
ng serve --host 0.0.0.0 --port 6000
  • You have reached the end of the article, Congratulations. You have learned how to Install AngularJS on Ubuntu 22.04.

Read more on AngularJS Documentation.

Other Tutorials

Install PostgreSQL on Ubuntu 22.04

Install MongoDB on Ubuntu 22.04

Install PHP 7.4 on CentOS 7

System administrator | Software Developer | DevOps

Leave a Comment