Modern and dynamic websites require many features, menus, and widgets to make the website user-friendly and reach the perfect marketplace. No matter which tool you use to create your website, javascript is always required to draw the finishing line. While we are talking about the javascript, we can’t ignore the Angular framework. Actually, there is no question to ignore the Angular application. Nowadays, the Angular CLI is the most popular method run the Angular application on web-framework. You can easily install and configure the Angular CLI on any Linux distributions. Moreover, the Angular CLI is the most popular and efficient way to maintain the back-end of Javascript.
There was a time when web developers used to use the GUI-based Angular for javascript. But as time has changed, programming has also developed a lot. As a result, the graphical user interface based Angular is no longer used by developers to maintain the javascript framework. Developers and recruiters are now looking for them who have a good command over the Angular CLI (Command Line Interface).
Angular CLI on Linux
As Angular is a cross-platform tool, the Angular CLI has a very important role in developing front-end, mobile applications, and desktop applications. It is more speedy than the GUI based Angular on any platforms. You can use the Angular CLI for code reusability, increase the loading speed, and make the performance better. Moreover, developers feel comfortable working on the Angular CLI because of its command-line interface, which is faster and easily executable.
As Linux is well known for speedy performance and doesn’t require high maintenance, the Angular CLI works perfectly on any Linux distributions. The CPU, Memory, and other hardware compatibility issues are rarely found on Linux while installing the Angular CLI. In this post, we will learn how to install the Angular CLI on different Linux distributions.
Using the Angular CLI instead of the graphical Angular doesn’t only boost your performance, rather it has a subtle ability to make your code clean and professional. In this post, we will see how you can install the Angular CLI on various Linux distributions.
1. Install Angular CLI on Debian and Ubuntu Linux
On Ubuntu and other Debian Linux systems, installing the Angular CLI is pretty simple and straight forward. First, all you need to do is install the Node Version Manager (NVM) on your Ubuntu machine. Later, we will use the NVM tool to install the Angular CLI on Ubuntu.
Step 1: Install NVM on Ubuntu
First, run the following aptitude command given below to update your package repositories. Then run the cURL command to download the NVM bash script. If you don’t have the cURL installed inside your system, first install the cURL.
sudo apt-get install curl sudo apt update curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
Now, run the following bashrc
command and NVM command to install the node version manager tool inside your Linux system.
source ~/.bashrc nvm install node
Step 2: Install Angular CLI Via NPM
Till now, we have successfully installed the NVM tool on our Debian system. Finally, we are about to install the Angular CLI on our Ubuntu system. Here, I am going to install the latest version of Angular CLI on our Linux system. Run the following node package manager (NPM) command given below to install the latest global version of Angular CLI on your Ubuntu Linux system.
npm install -g @angular/cli
If you want to install any other previous version of Angular CLI, you can run one of the following commands-lines given below. The version number is mentioned right after the @
symbol.
npm install -g @angular/cli@8 npm install -g @angular/cli@9 npm install -g @angular/cli@10
After the installation of Angular CLI is done, you can now check the version of your Angular CLI to ensure that the tool is installed successfully inside your machine.
ng --version
If you are a newbie in the Angular CLI, you run the following help command to get an idea about the syntaxes of the Angular CLI.
ng –help
Step 3: Remove Angular CLI from Ubuntu
There might be some reasons or errors that might cause you to uninstall the Angular CLI from your Ubuntu Linux. Now, to remove the Angular CLI from your Debian and Ubuntu machine, you can run the following command-lines given below.
npm uninstall -g angular-cli npm uninstall -g @angular/cli npm cache clean npmcache clean --force
2. Install Angular CLI on Fedora and RedHat
Installing the Angular CLI on Red Hat Linux based systems are not a tough job. You need to know how it works and what are the prerequisites for installing the Angular CLI. As we are working on the Javascript, we must ensure that the javascript is fully functional on our Red Hat Linux system. Here, I am using Fedora Linux to demonstrate the procedure; you can run the following steps on any Red Hat-based Linux systems.
Step 1: Install NodeJS on Fedora and RedHat Linux
To install the Angular CLI on our Red Hat and Fedora Linux, we need to install the NodeJS on our system. The NodeJS and the NPM tools will make a perfect environment for the Angular CLI. Now, run the following cURL command in your Linux terminal to get the NodeJS and NPM tools. Make sure that the CURL is installed inside your system.
curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash -
Now, run the following YUM command to finish the installation of NodeJS. The YUM command works on both Fedora and Red Hat Linux.
sudo yum install nodejs
You can now run the following command-lines given below to ensure whether the NODE and NPM are installed correctly on your system or not.
node --version npm --version
Step 2: Install Angular CLI on Fedora and Red Hat Linux
As we have installed the NPM tool on our Linux system, we will now use the NPM commands to install the Angular CLI. Installing the Angular CLI is via the NPM is a very simple task. You need to run the following NPM command given below on your Linux terminal to install the latest global version of Angular CLI on your Linux system.
sudo npm install -g @angular/cli
If you need to install another older version of Angular CLI on your system, you can run any of the following command-lines given below on your terminal. The version numbers are assigned right after the @
sign.
npm install -g @angular/cli@9 npm install -g @angular/cli@8 npm install -g @angular/cli@7
Now, after the installation of Angular CLI is done, we can check the version of the Angular CLI to make sure that the package is installed successfully inside our machine.
ng –version
3. Angular CLI on Arch Linux
As we all know that, installing any packages on Arch and Arch-based Linux is a little bit different than any other Linux distributions; there are no exceptions here as well. In this case, first, we have to install the NodeJS inside our Arch Linux system. Then we will install the NPM tool on our system.
Step 1: Install NodeJS and NPM on Arch Linux
Here, I am using Manjaro Linux to demonstrate installing the Angular CLI on Arch Linux. All the command-lines would run smoothly on any other Arch-based Linux distributions. Now, run the following Pacman command-lines given below to install the Nodejs and NPM on your Arch Linux.
sudo pacman -Syyu nodejs sudo pacman -S npm
Then, run the following command-line given below to update your node package manager (NPM) environment. Here, the -g
syntax symbolizes that the global version of NPM is being installed and updated.
npm update -g
After the installation is done, you can now run the following command-lines given below to check the Node and NPM versions to ensure that the NODE and NMP are installed successfully inside your Arch Linux system.
node -v nmp -v
Step 2: Install Angular CLI on Arch Linux
As we have installed the NodeJS and the NPM on our Arch Linux system, now, in this step, we will use the NPM command to install the Angular CLI on our Arch Linux system. Run the following command line given below to install the latest and global version of Angular CLI on your Arch Linux system.
sudo npm install -g @angular/cli
Finally, when the installation of Angular CLI is done, you can now run the following ng
command on your Linux terminal to ensure that the Angular CLI is installed correctly on your Arch Linux system.
ng version
If you are more interested in the Angular CLI on Arch Linux, you can visit this link to find more pieces of information about the Angular CLI on Arch Linux.
Get Started With Angular CLI
Finally, we have successfully installed the Angular CLI on our Linux distributions. Now, it’s time to take a tour. Before doing anything, we should add the Angular port in the firewall rule. If you are using the UFW firewall, run the following commands to add port 4200 into the firewall list.
sudo ufw enable sudo ufw allow 4200/tcp sudo ufw reload
If you are using Fedora, Red Hat Linux, and other Linux distributions, you use the Firewalld command to enable port 4200 for your environment. First, enable the Firewalld on your Linux system.
systemctl status firewalld systemctl enable firewalld sudo firewall-cmd --reload
Now, add the rule to the Firewalld settings. Then restart the Angular CLI system.
firewall-cmd --add-port=4200/tcp firewall-cmd --list-all
Now, make sure that the localhost server is functional on your Linux system. Then, type the URL given below into your web-browser’s address bar, then hit the Enter button. To avoid any server-level confliction, make sure that you don’t have both the Apache and the Nginx server installed in the same machine.
https://localhost/4200
Final Words
If you are a javascript developer, you might know that the Angular CLI has a vast demand in the programming world. Moreover, as the Angular CLI can be used on any platform, it has a huge demand in any programming sector. Using the Angular CLI instead of the graphical Angular doesn’t only boost your performance, rather it has a subtle ability to make Your code clean and professional.
In this post, I have described how you can install the NodeJS and NPM on your Linux system, and later you can install the Angular CLI through the NPM tool. As Linux users are more comfortable with the command-line based interface, so no doubt, it would be easy to learn and apply the Angular CLI for the Linux users.
If you like this post, please share it with your friends and the Linux community. You can also write down any comments regarding this post in the comment section.
Okay, I’ve installed npm on Mint 21 with your guide. Now how can I remove all of this? I’m constantly getting errors like ‘/.nvm/versions/node/v19.0.1/bin/node: No such file or directory’
This site can’t be reachedlocalhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED