DEV Community

Daniel Joshua
Daniel Joshua

Posted on

How to Deploy a Linux Virtual Machine(VM) on Microsoft Azure

Deploying a Linux Virtual Machine on Microsoft Azure is one of the most common first steps into cloud computing. Whether you are a student, DevOps engineer, or system administrator, Azure makes it easy to spin up secure, scalable Linux servers in minutes.

step-by-step process to deploying a Linux VM on Azure

Prerequisites

Before you begin, ensure you have:

  • An active Microsoft Azure account
  • Basic knowledge of Linux and virtual machines
  • Internet access and a modern web browser

Step 1: Sign in to the Azure Portal

  1. Open your browser and go to: https://portal.azure.com
  2. Sign in with your Microsoft account

Microsoft Azure image
Step 2: Create a New Virtual Machine

  1. In the Azure Portal dashboard, click Create a resource
  2. Select Compute → Virtual Machine

VM-Creation image

Step 3: Configure Basic VM Settings
Under the Basics tab, fill in the following:

  • Subscription: Select your Azure subscription
  • Resource Group: Create a new one or select an existing group
  • Virtual Machine Name: e.g., linux-vm-01
  • Region: Choose the closest region to you
  • Image: Select a Linux distribution (e.g., Ubuntu Server 22.04 LTS)
  • Size: Choose a VM size (e.g., Standard_B1s for free-tier users)

Basic Config-Image
Step 4: Set Administrator Account
Choose how you want to access the VM:

  • Authentication type: SSH public key (recommended)
  • Username: e.g., azureuser
  • SSH Key: Generate a new key pair or use an existing one

Admin account-Image
Step 5: Configure Networking
Azure automatically creates networking resources, but confirm:

  • Virtual Network (VNet) is selected
  • Subnet is configured
  • Public IP is enabled
  • Inbound ports: Allow SSH (port 22)
  • Remember to create HTTP port 80 during configuration

Basic Config-Image
Step 6: Review and Create the VM

  1. Click Review + Create
  2. Azure will validate your configuration
  3. Click Create to deploy the VM

Review and create-VM Image
Step 7: Connect to the Linux VM via SSH
Once deployment is complete:

  1. Go to the VM resource page
  2. Copy the Public IP Address
  3. Open a terminal and run:

SSH-Pair key Download
Go to the VM Resource page:

Deployment ready
Connect the Resource:

Connect to the resource
After connecting to the resource click on Edit Settings, a pull down menu will come up, then go back to your local system and locate your downloaded SSH Key pair and copy it and paste it into the path to your local machine, under SSH Command.

SSH Path to local machineImage
After copying the SSH Key into the path that will link the Linux-VM with the local system. open command line Interface and copy the generated SSH path to the command line interface opened with Administrator's Privileges
After pasting the SSH Key path, it will ask you if you are sure to continue, click yes! and continue. then run this sudo command: sudo apt update

This is a command used in Debian-based Linux systems (like Ubuntu) to refresh the local cache of available packages, downloading the newest lists from repositories

CLI-Image
Then run the second command,sudo apt install nginx

sudo apt install nginx-Image

Finally copy the Public IP Address from created in Azure Network and paste it into a browser, if everything goes well the bellow webpage would be displayed showing Welcome to nginx!

NGINX-Image
NGINX is a high-performance, versatile tool used as a web server, reverse proxy, load balancer, content cache, and mail proxy, efficiently handling modern internet traffic by serving static content, managing requests to backend servers, distributing load for scalability, and improving performance through caching. Its event-driven architecture allows it to manage thousands of concurrent connections with low resource usage, making it ideal for busy websites and complex applications.

F5-nginx-Image
Conclusion
Deploying a Linux VM on Microsoft Azure is simple, fast, and flexible. With just a few clicks, you can provision secure cloud infrastructure suitable for development, testing, or production workloads.

Top comments (0)