33.8 C
Senior Writer and partner

How to install AngularCLI on Ubuntu 18.04?

At present, the field of web application development is quite competitive. Every day there are more tools that are focused on this area. Of those aspects, the front end stands out because it is the entrance door of the application. In fact, for many users, the graphics aspect is the first evaluation criterion that counts when evaluating an application. In the front end of a web application, we find Javascript that adds dynamism to HTML. From Javascript, there are many frameworks but the most popular is perhaps Angular. So, in this post, I will show you how to install AngularCLI, the tool with which you can create projects in Angular.

AngularCLI: a command line interface for Angular

Angular is a Javascript framework for creating the front end side using the MVC pattern. It was created in 2009 by Google and is becoming more and more popular. Thanks to Angular we will be able to speed up the work from the front end using a lot of Javascript functionalities perfectly organized. Its methodology is the SPA, i.e. single page application.

On the other hand, Angular is being widely used in a new stack called MEAN (MongoDB, ExpressJS, Angular and NodeJS) where you can create other types of web applications.

In order to have a tool to manage Angular better, it is that AngularCLI arises. AngularCLI is a command line interface for Angular, with it, we can create an application that already works, right out of the box.

- Advertisement -

So, if you use Angular or you want to learn about it, you have to install AngularCLI.

Getting AngularCLI on Ubuntu 18.04

Before we go on, you need to know that we will need NodeJS. Next, you have to be able to use sudo with your user. Besides, you need some knowledge about the use of the terminal in Ubuntu.

Install NodeJS on Ubuntu 18.04

The first step is to install NodeJS 10 at least. Don’t worry it’s quite simple and we’ve made a post dedicated to it.

Read How to install NodeJS on Ubuntu 18.04?

Then you can continue with the tutorial.

Install AngularCLI on Ubuntu 18.04

Once you have made sure that NodeJS and NPM are properly installed in the terminal run the following.

:~$ sudo npm install -g @angular/cli

1.- Install AngularCLI on Ubuntu 18.04
1.- Install AngularCLI on Ubuntu 18.04

Next, check the installed version.

:~$ ng new example-project

2.- Creating a new project with AngularCLI
2.- Creating a new project with AngularCLI

Then, access the directory of your newly created project. Then, using the serve command, you can access your application. Note that the default port is 4200.

:~$ cd example-project
:~$ ng serve

This will make the application available at http://localhost:4200, but many times we need to specify a particular host. To do this, run:

:~$ ng serve --host [host_ip] --port [port]

Next, open it using your web browser. For example,

3.- Angular is working
3.- Angular is working

And that is it.


Thanks to this post, you have learned how to install AngularCLI in Ubuntu 18.04. This being one of the most used distributions to develop applications for its stability and ease of use.

In this sense, it is possible to affirm with almost total certainty that AngularCLI facilitates the management of Angular projects. Thus it is possible to improve our productivity.

Please share this post with your friends.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article