DEV Community

Ezekiel Umesi
Ezekiel Umesi

Posted on

How I Created a Linux VM on Azure and Installed NGINX

As part of my ongoing cloud computing training, I was tasked with deploying a Linux virtual machine (VM) on Microsoft Azure and installing NGINX web server on it. Below is a breakdown of the entire process — from creating the VM to accessing the NGINX welcome page.


Step 1: Log into the Azure Portal

I started by logging into https://portal.azure.com using my Microsoft account.

Image description


Step 2: Search for “Virtual Machines”

In the Azure Portal, I used the search bar at the top to search for “Virtual Machines” and selected it from the dropdown menu.

Image description

Step 3: Create a Linux VM

I clicked the “+ Create” button and selected “Azure virtual machine.”

In the Basics tab, I entered the following configuration:

  • Subscription: My current Azure subscription
  • Resource Group: Selected an existing one or created a new one
  • Virtual Machine Name: linux-nginx-vm
  • Region: Chose the closest Azure region
  • Image: Selected Ubuntu 22.04 LTS
  • Size: Chose a lightweight option like Standard_B1s
  • Authentication type: Selected Password
  • Username and Password: Set my SSH login credentials

⚠️ Make sure to allow port 22 (SSH) under the Inbound port rules so you can connect to the VM.

Step 4: Review + Create

After confirming the settings, I clicked “Review + Create”, waited for validation to complete, and then clicked “Create.” Azure started provisioning the VM.

Step 5: Connect to the Linux VM via SSH

Once the VM was deployed, I connected using SSH.

I copied the public IP address from the VM overview and ran the following command from my terminal:

ssh <username>@<public-ip>
Enter fullscreen mode Exit fullscreen mode

It prompted for my password, and then I was successfully logged into the Linux VM.

Image description


Step 6: Install NGINX on the Linux VM

After logging in, I ran the following commands to install NGINX:

sudo apt update
sudo apt install nginx -y
Enter fullscreen mode Exit fullscreen mode

Once installed, I confirmed the status of NGINX:

sudo systemctl status nginx
Enter fullscreen mode Exit fullscreen mode

The output showed that NGINX was active (running).

Image description


Step 7: View the NGINX Welcome Page

To access the default NGINX web page, I opened a browser and visited:

http://<public-ip>
Enter fullscreen mode Exit fullscreen mode

The NGINX welcome page appeared, which means the installation was successful.

Image description


Summary

Step Description
1 Logged into Azure Portal
2 Created a new Ubuntu VM
3 Connected via SSH
4 Installed NGINX
5 Verified using the public IP in a browser

Lessons Learned

  • How to provision a Linux VM in Azure
  • How to connect to a Linux VM using SSH
  • How to install and start NGINX using basic terminal commands
  • The role of inbound port rules in exposing services like NGINX

Top comments (0)