Deploy Angular Project on an ubuntu server with pm2

claudemotoba

claudemotoba

Posted on December 9, 2021

Deploy Angular Project on an ubuntu server with pm2

1. Install NodeJs

sudo apt install nodejs

node -v
// v16.13.0
Enter fullscreen mode Exit fullscreen mode

2. Install pm2

sudo npm install pm2 -g

pm2 -v
// 5.1.0
Enter fullscreen mode Exit fullscreen mode

3. Install Git

sudo apt install git

git --version
// git version 2.17.1
Enter fullscreen mode Exit fullscreen mode

4. Install Angular CLI

sudo npm install -g @angular/cli 

ng version
// Angular CLI: 13.0.3
Enter fullscreen mode Exit fullscreen mode

5. Clone Project and Install package

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

cd <project-name>

sudo npm install
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
claudemotoba
claudemotoba

Posted on December 9, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related