Setting Up a Linux Virtual Machine on Azure

Setting Up a Linux Virtual Machine on Azure

Deploy and Manage Your Ubuntu Server in Minutes

In today's cloud-centric world, understanding Virtual Machines (VMs) is essential for every IT professional and developer. For those managing Linux servers, Microsoft Azure offers a robust platform with all the necessary tools. This guide will walk you through creating a Linux VM on Azure using Ubuntu Server.

Step-by-Step Guide

1: Sign in to the Azure Portal

First, navigate to the Azure Portal and sign in with your Microsoft account.

2: Create a Virtual Machine

1. Navigate to the Virtual Machines section:

In the Azure portal, click on "Create a resource" from the left-hand menu. Select "Compute" and then "Virtual Machine".

  1. Configure Basic Settings

Subscription: Choose your Azure subscription.

Resource group: Create a new resource group or select an existing one.

Virtual machine name: Enter a unique name for your VM.

Region: Select the region where you want to deploy the VM.

Image: In the "Image" dropdown, select "Ubuntu Server 20.04 LTS - x64 Gen2 (free services eligible)". This is highlighted in the image below.

Size: Choose the size of the VM based on your performance needs and budget.

  1. Set Authentication:

Authentication type: Choose between SSH public key or password.

SSH is recommended for better security.

Username: Enter a username for the VM.

SSH public key: If you selected SSH, paste your public key here.

  1. Configure Inbound Port Rules

    Select SSH (22) as Inbound Port:

    In the "Networking" section of your VM setup:

    Find the "Public inbound ports" section.

    Select "Allow selected ports".

    Check the box for SSH (22). This will open port 22, which is necessary for SSH access to your Linux server.

  2. Disk Configuration

Select OS Disk Type:

On the Disk page, click on the OS disk type dropdown.

Select "Premium SSD" or any disk type of your choice. Leave other options as default.

Network, Management, Monitoring, and Advanced Configuration

Default Settings:

Leave the networking, management, monitoring, and advanced pages with their default settings.

Review and Create

  1. Review Configuration:

    Click "Review + create" to review the summary of your VM configuration.

    Ensure all settings are correct.

    Click the "Create" button to start the deployment process.

    Go to Resource:

    Once the deployment is complete, click "Go to resource" to access your VM.

  1. Connecting to Your Virtual Machine

    On the VM overview page, click the "Connect" button to SSH into your VM.

  2. Copy SSH Command

    Scroll down to find the SSH command in the red box. It should look like this:

    ssh username@ipaddress.

8. Open PowerShell

Open PowerShell or any terminal on your laptop. Paste the SSH command and press enter.

If everything is set up correctly, you should see a window indicating that the remote connection via SSH has been established.