Temiloluwa Adediji
Posted on April 15, 2024
Embarking on the journey of deploying a Linux virtual machine opens up a world of possibilities within the dynamic landscape of cloud computing.
In this comprehensive guide, we delve into the intricacies of provisioning a Linux-based virtual machine (VM) on the Azure platform. This article serves as your compass, guiding you through every step with clarity and precision. Whether you're a seasoned IT professional or an aspiring enthusiast, join me as we unravel the intricacies of deploying a Linux VM, empowering you to harness the full potential of cloud infrastructure with confidence.
CREATING A LINUX VIRTUAL MACHINE
1) Sign in to Azure Portal
Sign into the azure portal to get started. If you don't already have an account, Click here to create a free account.
Now that you're all set, let's begin!
2) In the search bar, type 'Virtual Machine'.
3) From the search results, select the highlighted virtual machine from the displayed list of resources.
You will be directed to the 'Virtual machines' page.
4) Click on the create dropdown and select the highlighted VM from the menu.
You will be directed to the 'Basics' page.
Project Details
Subscription
An Azure subscription is essentially a billing and account management container within Microsoft Azure. When you sign up for Azure, you create a subscription and all the resources you create within Azure are associated with that subscription. You can learn more about Azure Subscription on the official Microsoft documentation website.
Resource group
5) Select an earlier created resource group from the drop down or create a new resource group.
Instance Details
6) Name your Virtual Machine. Be sure to adhere to the naming conventions expected by Azure.
7) Select a region from the drop down. Note that the region of your resource can be different from that of your resource group.
Proximity and cost are important factors to consider when selecting an Azure region. Read more about choosing a suitable region.
8) Select an Availability Zone
In Azure, an availability zone is a unique physical location within an Azure region. Each zone is made up of one or more data centers equipped with independent power, cooling, and networking infrastructure. Azure availability zones are designed to provide high availability and resiliency for applications and data by ensuring that they are isolated from failures in other zones within the same region.
By deploying resources across multiple availability zones, you can protect your applications and data from failures due to hardware or network issues in a single zone. This helps to ensure that your services remain available and resilient even in the face of unexpected events.
9) Select a Security type
10) Select an Image Type
In Azure, the term 'image' typically refers to the template or snapshot that defines the operating system, software configuration, and other settings for the VM.
11) Leave the VM architecture and Run with Azure Spot discount fields as default.
12) Select a suitable size for your VM.
Inbound Port Rules
In Azure, inbound port rules refer to the configurations that control access to resources within your Azure environment from external sources, such as the internet or other networks. These rules are typically managed through Azure Network Security Groups (NSGs) or Azure Firewall, which allow you to define filtering rules based on source and destination IP addresses, ports and protocols.
13) Select the SSH option from the drop down.
SSH (Secure Shell) port is the default port used for establishing secure remote shell connections to a server or device using the SSH protocol. The default port number for SSH is 22.
Administrator Account
14) Select an Authentication Type.
In Azure, Linux virtual machines (VMs) support two authentication methods for accessing and managing the VMs. They include:
SSH Key Authentication
SSH (Secure Shell) key authentication is the most common method used to authenticate with Linux VMs in Azure.
With SSH key authentication, you generate a public-private key pair on your local machine.
When you attempt to connect to the VM via SSH, your local SSH client uses the private key to authenticate with the VM. If the private key matches the public key stored on the VM, access is granted.
SSH key authentication provides a high level of security and comes highly recommended for SSH access to Linux VMs in Azure.
Password Authentication
Password authentication involves logging in to the Linux VM using a username and password combination.
When creating the Linux VM in Azure, you have the option to specify a username and password. You use these credentials to log in to the VM via SSH.
While password authentication is straightforward, it's generally considered less secure than SSH key authentication because passwords can be susceptible to password guessing attacks or interception.
Authentication via SSH public key
a) Select the SSH public key option
b) Fill in a username
c) Select 'Create Generate new key pair'
d) Give your key pair a name
Authentication via Password
a) Select the Password option
b) Fill in a username
c) Fill in your password
Disks
15) Click on the OS disk type dropdown and select Standard SSD or any disk type of your choice. Maintain the default values of other fields
16) Maintain the networking, management, monitoring and advanced and Tag pages as default.
17) Click on 'Review+create'
18) Review the summary of your VM configuration and click on 'Create' to start the deployment process.
19) For the SSH public key, you will be prompted to download the private key. Go ahead to download.
20) Once the deployment is complete, click on 'Go to resource'. This takes you to the Overview page of your VM.
CONNECTING TO YOUR LINUX VIRTUAL MACHINE
Using the SSH public key
1) Select connect from the drop down menu as show.
2) Scroll down and click on 'select' on the Native SSH pane.
3) Locate the earlier downloaded private key and copy the path. To do this, right click, hold down the 'options' key and select the 'Copy as Pathname' option.
4) Return to azure and paste the copied path into the field as shown.
5) Copy the SSH command as below.
6) Open up your Mac terminal and type in 'pwsh' followed by 'return' key. If you don't already have powershell instead, use this guide for installation.
7) Paste the SSH command into your terminal followed by the return key.
8) You will be prompted to continue, enter 'yes' and then the return key.
9) A welcome message will be displaced as shown below.
Using the Password Authentication
1) Select connect from the drop down menu as show.
2) Copy the Public IP of your VM from the overview page.
3) Open up your Mac terminal and type in 'pwsh' followed by 'return' key. If you don't already have powershell instead, use this guide for installation.
2) Input the following SSH command: ssh username@IP. For example : ssh Temiloluwa@20.51.206.27
3) You will be prompted to continue, enter 'yes' and then the return key.
4) You will be prompted to input your passoword. Be sure to input this correctly and note that the password doesn't show while typing. Once finished, hit the return key.
5) A welcome message will be displaced as shown below.
Viola!!! We just created and connected to a Linux box. Not as straightforward as a Windows VM, I must say.
As you embark on your Azure adventure, remember that the skills acquired here are just the beginning. With your Linux VM up and running, you're ready to delve into a world of possibilities, from deploying applications and services to optimizing performance and scalability.
Thank you for joining me on this journey of discovery. May your Linux VMs in Azure pave the way for countless achievements and breakthroughs in your cloud endeavors.
Temiloluwa Adediji
Posted on April 15, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.