Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to install Angular CLI on CentOS or RHEL

This guide shows you how to install Angular CLI on CentOS or RHEL versions 6, 7 and 8. It needs root access, so it fits VPS and dedicated servers.

How-To Guides2 min read12 steps

What is Angular CLI?

Angular is a tool for building web apps. The CLI (command line interface) is a program you control by typing commands. With it you can create and run Angular projects quickly.

Angular CLI needs Node.js. Node.js lets you run JavaScript outside a web browser. It also brings npm, a tool that downloads add-ons.

Tip: CentOS 6 and 7 are old. Newer Node.js versions may not run on them. The steps below work the same way on newer systems, but you may need to pick an older Node.js release on CentOS 6.

Steps

  1. Log in to your server over SSH as root.
  2. Update your packages.
yum update -y

This downloads the newest fixes for installed software.

  1. Add the Node.js source. The number 18 is an example. Pick a version that your system supports.
curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -

This tells your system where to download Node.js from.

  1. Install Node.js.
yum install -y nodejs

This installs Node.js and npm.

  1. Check both are installed.
node -v
npm -v

Each command prints a version number.

  1. Install Angular CLI for the whole server.
npm install -g @angular/cli

The -g flag means global. Any user on the server can then use the ng command.

  1. Confirm the install.
ng version

You should see the Angular CLI version and your Node.js version.

Create a test project

  1. Go to a folder where you keep projects.
  2. Run ng new my-app.
  3. Answer the questions. The default answers are fine.
  4. Go into the folder with cd my-app.
  5. Start it with ng serve --host 0.0.0.0.

Your app now runs on port 4200. You may need to open that port in your firewall.

Common problems

  • Command not found: Close and reopen your SSH session.
  • Node version too old: Angular needs a fairly new Node.js. Install a newer one from NodeSource.
  • Not enough memory: Small servers can fail while building. Ask Hostvento support about your server size.

Quick recap

  • You need root access and SSH.
  • Install Node.js first, then Angular CLI with npm.
  • Use ng version to check the install.
  • Create a test app with ng new.