+(91)70149-37521Subscribe Now

How to Install Angular CLI on Rocky Linux 9 and EL9

Angular CLI creates, develops, tests, and builds Angular applications from the command line. This guide shows how to install Angular CLI on Rocky Linux 9, AlmaLinux 9, RHEL 9, and CentOS Stream 9 with a compatible Node.js version. The original article used Node.js 12 and Angular 10 on CentOS 7/8. Those versions are obsolete. The […]

Install AngularJS on CentOS

Angular CLI creates, develops, tests, and builds Angular applications from the command line. This guide shows how to install Angular CLI on Rocky Linux 9, AlmaLinux 9, RHEL 9, and CentOS Stream 9 with a compatible Node.js version.

The original article used Node.js 12 and Angular 10 on CentOS 7/8. Those versions are obsolete. The updated guide uses Angular 22, which is the active Angular release in August 2026, and a supported Node.js 22 release. Always check Angular’s compatibility table when you read this later because the required Node version changes over time.

Angular and AngularJS Are Different

This tutorial installs modern Angular, not the old AngularJS 1.x framework. Angular CLI is published as the npm package @angular/cli and provides the ng command.

Prerequisites

  • A supported EL9 system with internet access
  • A normal user with sudo permission
  • Git and basic command-line knowledge
  • Enough disk space for Node packages and project builds

Update the system and install the basic tools:

sudo dnf update -y
sudo dnf install -y git curl

Install a Compatible Node.js Version with NVM

Angular requires an active or maintenance LTS version of Node.js. NVM is useful on a development machine because it installs Node for your user and lets different projects use different versions. Do not run NVM or npm with sudo.

Download the official NVM 0.40.6 installer, inspect it if your security policy requires review, and run it:

curl -o /tmp/install-nvm.sh https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.6/install.sh
less /tmp/install-nvm.sh
bash /tmp/install-nvm.sh

Open a new terminal, or load NVM into the current Bash shell:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

Install a Node.js version supported by Angular 22 and make it the default:

nvm install 22.22.3
nvm alias default 22.22.3
node --version
npm --version

Angular 22 also supports the compatible Node 24 and Node 26 ranges shown in its official table. An exact version keeps this walkthrough repeatable, while nvm install --lts is convenient only when the current LTS also matches your Angular version.

Install Angular CLI

Install Angular CLI for the current NVM-managed Node version:

npm install -g @angular/cli@22
ng version

The version output should list Angular CLI 22 and the compatible Node version. With NVM, a global npm package belongs to the selected Node installation. If you switch Node versions, you may need to install the CLI for that version or use the project-local CLI.

Create Your First Angular Application

Create a workspace called my-angular-app:

ng new my-angular-app

Angular CLI asks about stylesheet format, routing, rendering, and other features. Choose the options that match your project. The command creates the folder, configuration, source files, and npm dependencies.

cd my-angular-app
git status
npm test

Run the Angular Development Server

For development on the same machine, run:

ng serve

Open http://localhost:4200/. The development server watches source files and rebuilds the app when they change.

Do not expose ng serve directly as a production web server. If you work on a remote machine, an SSH tunnel is safer than opening port 4200 to the internet:

ssh -L 4200:127.0.0.1:4200 user@server-ip

Keep that SSH session open, start ng serve on the remote machine, and browse http://localhost:4200/ on your own computer.

Build Angular for Production

Create an optimized production build:

ng build

Angular writes build output under the project’s dist/ directory. Deploy that output through a supported hosting method or a properly configured web server. A single-page application may need a fallback rule so application routes return the main HTML file instead of a 404.

If you use Apache, our Apache virtual-host guide explains configuration testing and HTTPS basics. Adapt the document root and routing rules to Angular’s current deployment documentation.

Use a Project-Local Angular CLI

Teams often prefer the CLI version recorded in each project’s package.json. Inside an existing Angular workspace, install exactly what the project declares with:

npm ci
npx ng version
npx ng build

npm ci uses the lockfile for a reproducible install and removes an existing node_modules directory. Commit the lockfile, but do not commit node_modules.

Update Angular CLI Safely

First commit or back up the project. Check its current versions and available migrations:

ng version
ng update

Follow Angular’s update guide one supported major step at a time, run tests, and review generated changes. Do not upgrade Node and Angular blindly on a production build server.

Troubleshooting Angular CLI

ng: command not found

Open a new shell, confirm nvm current, and run npm prefix -g. Reinstall the CLI under the selected Node version if necessary.

Unsupported Node.js Version

Compare the Angular major version with the official compatibility table. Use nvm install VERSION and nvm use VERSION to select an allowed version.

EACCES Permission Error from npm

Make sure NVM owns the selected Node installation and do not prefix npm with sudo. Check which node and which npm; both should point inside your user’s NVM directory.

Port 4200 Is Already in Use

Stop the old development server or choose another local port with ng serve --port 4300.

Frequently Asked Questions

Do I need Angular CLI globally?

No. A global CLI is convenient for creating projects. Existing projects can use their local version through npx ng or npm scripts.

Can Angular run on Rocky Linux 9?

Yes. Angular’s tooling runs through a compatible Node.js version. Use NVM or another trusted installation method and verify the Angular/Node version pair.

Is ng serve suitable for production?

No. It is a development server. Build the app and serve the production output through a proper deployment platform or web server.

Conclusion

You have installed a compatible Node.js version, added Angular CLI 22, created a workspace, and tested the development and production commands. Keep the project’s Node and Angular versions documented so another developer or build server can reproduce the environment.


Reviewed and updated: August 2026. The workflow was checked against Angular’s official local setup guide, version compatibility table, and the official NVM project.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to Our Newsletter

Get free how-to tutorials and over 700+ courses. Seo tips, create a wordpress, or learn a new skill.