How to deploy Angular project on Linux server? — A Step-by-Step Guide

Ayyaz Zafar
4 min readNov 8, 2023

Introduction: In today’s rapidly evolving web development landscape, deploying Angular projects on a Linux server is a vital skill for developers. This comprehensive guide will walk you through the process of setting up your Angular project on a Linux server using DigitalOcean. Whether you’re working on a personal project or for a client, these steps will ensure your deployment is smooth and successful.

Creating a Linux Virtual Machine: First and foremost, if you don’t already have a Linux server, you’ll need to set one up. For this tutorial, we’ll use DigitalOcean to create a new Linux virtual machine. Simply click on the “Create” button and select “Droplet”.

DigitalOcean offers a marketplace where you can choose a pre-configured server. For our purposes, we’ll select the LAMP (Linux, Apache, MySQL, PHP) option.

Now run following command in your terminal to get your ssh key that we will using in our droplet.

# Command to generate a new SSH key
ssh-keygen

Now copy the key as shown in this screenshot:

# the command to use to get the public key
cat ~/.ssh/id_rsa.pub

After generating your SSH keys, you can add your public key to DigitalOcean. Navigate to your .ssh directory and copy your public key to add it to your DigitalOcean account.

Setting Up Your Angular Project: Before deploying, ensure you have an Angular project ready. If not, you can easily create one using the Angular CLI with the following command:

ng new my-angular-project

--

--