How to Install AngularJS on Ubuntu 22.04 LTS

Angular is a popular, open-source web application framework for building mobile and desktop apps. It was developed in 2009 by Google to help developers design complex applications from scratch without having expert knowledge of coding languages like C# or Java which can take up valuable time when you want something simple with little functionality at first but grow as your project develops over the years.

In the following tutorial, you will learn how to install Angular on Ubuntu 22.04 LTS Jammy Jellyfish using the command line terminal using the NodeSource repositories as the source for NodeJS and NPM.

Update Ubuntu

First, before anything, update your system to ensure all existing packages are up to date to avoid any conflicts.

sudo apt update && sudo apt upgrade

Install Required Dependencies

Next, to ensure the installation goes smoothly following our tutorial, run the following command, which will install any missing packages that may be required.

sudo apt install curl gnupg2 gnupg git wget -y

Install Node.js

Currently, Angular is only supported on LTS versions of Node.js, but for the tutorial, you will install the NodeSource repository and the latest LTS version available on your system.

Import the repository self-set up the script using the following command, which will also execute it.

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

Next, run a quick APT update to reflect the newly added imports.

sudo apt update

Now that you have installed the repository install Node.js as follows.

sudo apt install nodejs

Confirm the version and build of Node.js that was installed.

node --version

Lastly, ensure your NPM is up-to-date using the following command; this is critical; do not skip.

sudo npm install npm@latest -g

Install AngularJS

Use the following command to install the AngularJS CLI tool.

sudo npm install -g @angular/cli

Once installed, verify the version using the following command.

ng version

Example output:

How to Install Angular on Ubuntu 22.04 LTS

Create AngularJS Project

Once you have successfully installed Angular, you will create a quick project.

First, create a new AngularCLI project; remember to change {project-name} to something else.

ng new {project-name}

Second, access the folder created with the name of the project.

cd {project-name}

Next, create and serve the project with the following command.

ng serve

Or you can change the host and port running your Angular application by providing the host and port as the example below.

ng serve --host your-server-ip --port 8088

For local environments, use localhost or for domains, use the domain name.

Example output:

How to Install Angular on Ubuntu 22.04 LTS

Access AngularJS Web Interface

Once the test project you created is delayed and listening on port 8088, you can now access it on the URL from your browser.

### Domain Access ###
http://example.com:8088

### IP Address ###
http://server-ip:8088

### Local Environments ###
localhost:8088

Once you arrive, you should see the following screen.

How to Install Angular on Ubuntu 22.04 LTS

Comments and Conclusion

If you are looking for a robust, feature-rich framework that will allow you to build high-quality mobile and web applications, Angular is the right choice. With its large community of contributors, ongoing development, and growing popularity, you can be sure that Angular will be around for years.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!