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?
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…
To follow this tutorial, we need:
• Ubuntu 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 17. Hence, we are going for the same. You can check out the latest version on its GitHub page.
Make sure you have curl, 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 have 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 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:
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.
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 required files, switch to that:
Now, run the given command to compile your app:
The above command will compile and run the applicant on 4200 port. To access the app, open your browser and point it to:
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:
ng serve --host 0.0.0.0 --port 8000
This was the quick guide over 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.