Deploy Angular Project on an ubuntu server with pm2

1. Install NodeJs

sudo apt install nodejs

node -v
// v16.13.0

2. Install pm2

sudo npm install pm2 -g

pm2 -v
// 5.1.0

3. Install Git

sudo apt install git

git --version
// git version 2.17.1

4. Install Angular CLI

sudo npm install -g @angular/cli 

ng version
// Angular CLI: 13.0.3

5. Clone Project and Install package

sudo git clone https://github.com/<username>/<repository>.git

cd <project-name>

sudo npm install

6. Run Angular with pm2

pm2 start "ng serve"

// you can specific host, port and name of your app
pm2 start "ng serve --host 0.0.0.0 --port 4205" --name "name"

// list app
pm2 list

47