Step 1 – Installing Node.js
NVM is a command line tool for installing and managing node.js on Linux system. So first we need to install nvm on our system. Login to system with user for which you need to install Node.js, then execute below command to install nvm: After that, you can install any version of node on your system. You can also install multiple node versions on single system. Execute below commands to load environment and install latest node.js version: The above command will display the version of node and npm installed on your system.
Step 2 – Installing Angular CLI
After installing the node.js and npm on your system, use the following commands to install the Angular CLI tool on your system. The latest version of Angular CLI will be installed on your Ubuntu Linux system. Using the -g above command will install the Angular CLI tool globally. So it will be accessible to all users and applications on the system. Angular CLI provides a command ng used for command-line operations. Let’s check the installed version of ng on your system. Angular command line interface has been installed on your system. For the existing application, can start your work and ignore rest article. Follow the next steps to create a new Angular application on your system.
Step 3 – Creating New Angular Application
You can use ng command to create a new angular application. Create application named hello-world using the Angular command line tool. Execute below command in terminal: Output: This will create a directory named hello-world in your current directory, and create all require files for an angular application.
Step 4 – Serve Angular Application
Your basic Angular application is ready to serve. Switch to directory hello-world and then run your angular application using the ng serve command. By default angular application run on port 4200. You can access your system on port 4200 to open the angular application, like:
http://localhost:4200
You can change host and port for running the Angular application by providing –host and –port command line arguments. The IP address 0.0.0.0 listens on all interfaces and publicly accessible.
Conclusion
In this tutorial, you have learned to install angular command-line utility as a node package. This tutorial also helped you to create a new angular application. Now, visit here to configure angular application behind the Apache server.