Logo

dev-resources.site

for different kinds of informations.

Step-By-Step: How To Create a Linux Virtual Machine In Azure

Published at
4/10/2024
Categories
linux
webdev
vm
Author
emmamag
Categories
3 categories in total
linux
open
webdev
open
vm
open
Author
7 person written this
emmamag
open
Step-By-Step: How To Create a Linux Virtual Machine In Azure

Ubuntu is a free and easy to install flavor of the Linux operating system, and it’s for desktops and servers. A lot of technologies used for the web, data science and software development are designed for Linux. You can run them using command-line. I’ve used Ubuntu when creating and hosting web pages, setting up SQL databases and Elasticsearch clusters, and managing containers with Docker.
In this blog post, we will explore the steps involved in setting up a Linux virtual machine using Ubuntu Server. By default, SSH access to virtual machines often relies on public key authentication for enhanced security. However, in this blog, we will use password-based authentication preferably.

We will also demonstrate how to prevent unexpected SSH disconnections due to idle sessions, it's important to extend the idle timeout for your IP address to prevent unexpected logouts.

Also, apart from deleting your resource group that houses your virtual machine and its dependents, I will show you how you can disassociate your IP address from the virtual machine when not in use to ensure cost optimization.

Let's get Started!!

SIGN IN TO AZURE PORTAL

As a prerequisite, If you don't have an Azure subscription, log in here to create a free account before we get started. Now that you have created your Azure subscription, sign in to the Azure portal using your mail and password to get started.

CREATE YOUR VIRTUAL MACHINE

a. In the search bar, type "Virtual Machine"

b. From the search results, select "Virtual Machine" from the list of resources shown

c. Click on the "Create" button

d.) Select the virtual machine highlighted

Image description

e)You will be directed to the "Basics" page.

Project Details

In the project details category, we have the subscription and resource group;

a) Subscription

An Azure subscription in simple terms means a membership or access pass to use Microsoft Azure. It's similar to subscribing to a service or signing up for a subscription plan. With an Azure subscription, individuals or organizations can use and benefit from the various services and resources provided by Azure at a cost depending on your type of subscription. However, it also offers free and trial options, giving you a chance to explore and experiment with Azure before committing to a paid subscription.

b)Resource Group

A resource group in Azure is like a container or folder that helps you organize and manage the different resources such as virtual machines and databases that you use in the Azure cloud.

Imagine you have a room with different items scattered all over the place. It becomes challenging to find what you need when everything is upside down. In this scenario, the room represents your Azure cloud environment, and the resources are the items in the room. Now, imagine you decide to tidy up and arrange your items where they are initially meant to be. Each compartment keeps related items organized and makes it easier to find what you need.

In the how-to guide, select your resource group or click on "Create new" to create a new resource group.

Image description

Instance Details

a) Give your virtual machine a name

b) In the region section, select the location you want your virtual machine to be.

A region refers to a specific geographical location with data centers that host infrastructure and services. Each region operates independently and is designed to be self-contained, with its own set of resources and infrastructure.

c) Next, click on the drop-down to select your availability option and availability Zone.

In Azure, a region can consist of three availability zones, known as Zone 1, Zone 2 and Zone 3. Each zone has one or more data centers that are kilometers apart from each other.

These data centers are equipped with independent power, networking, and cooling infrastructure to minimize the impact of failures and disruptions. What physically Links these data centers together is Fibre Optic Cable. Fiber optic technology allows for high-speed data transmission over long distances while maintaining low latency and high bandwidth capabilities.

Image description

d) Select your security type from the drop-down

e) In the image section, select any Ubuntu Server.

Ubuntu is a Linux Operating System. An image is an operating system. It's like a blueprint for creating virtual machines or computer systems. It has all the instructions and settings needed to set up a computer with a specific operating system and software.

f) Select the size of your virtual machine from the drop-down or click on "See all sizes". Leave the other information in its default state.

Image description

Administrator Account

a) Select the password authentication type.

Password-based authentication involves using a username and secret password to access a system as shown below.

While SSH public key authentication relies on key pairs and cryptographic algorithms for secure remote access. Public key authentication offers stronger security and protection against various attacks, making it a preferred choice for secure remote connections.

However, for the purpose of this demo, we will use Password.

b) Type your username and your password.

Image description

Inbound Port Rules

a) In this category, select SSH (22) as your inbound port to connect to the Linux server.

b) Click "Next: Disk>" to direct you to the disk page

Image description

Disk

a) On the Disk page click on the OS disk type drop-down and select Premium SSD or any disk type of your choice as shown below. Leave the other columns as default.

b) Leave the networking, management, monitoring and advanced pages as default. Skip to the Tag page.

Image description

Tag

a) Give your tag a name

Tags are a way to label and organize resources in cloud computing environments. The purpose of tags is to provide metadata or additional information that helps in managing, organizing, and tracking resources within a cloud infrastructure.

b) Next, click on Review+create

Image description

c) Review the summary of your virtual machine configuration and click on the "Create" button to begin the deployment process

Image description

d)Once the deployment is complete, click on "Go to resource".

Image description

CONNECT TO YOUR VIRTUAL MACHINE

a) Click on the connect button to SSH to your Virtual Machine

Image description

b) Scroll down to No 4, Copy the command in the red box and delete the command in the blue box. This will give you:

ssh username@ipaddress

Image description

c) Open PowerShell on your Laptop and input the command, Press enter

d) You would be asked if you want to continue connecting, type "yes" and press enter

Image description

e)At this stage, my connection has closed because it took me a while to run the command. If you got this, the next thing to do is to go back to Azure portal and locate your virtual machine.

Image description

f)On the overview page, click on your IP address.

Image description

g) Click on Configuration and increase the idle timeout to 30 minutes. Once you are done, ensure to save it.

Image description

h) Go back to your Powershell and input the ssh username@ip, press enter.

NOTE: If your connection did not time out/close, once you type yes and press enter, it would ask that you input your password.

i) Now input your password and press enter.

j) Once you press enter, you would be logged in to your virtual machine as shown below.

Image description

How To Disassociate IP Address

Situations may arise where you need to save cost running your virtual machine.One way to optimise cost is to disassociate your IP address from your virtual machine.

a) Click on your IP address

Image description

b) Click on the Overview.

c) On the overview page, click on dissociate at the top-right of the page.

Image description

d) It will ask you to confirm dissociation, click "Yes'. Once you click yes, your IP address will be dissociated from your Virtual Machine.

Image description

How To Associate IP Address

a)To associate your IP, simply click on the Associate button.

b) A page will open up, choose the Resource type as Network interface. Select your IP address and click on OK.

c) Your IP will be associated back to your virtual machine.

Image description

vm Article's
30 articles in total
Favicon
Create a Linux Virtual Machine in Azure
Favicon
Proxmox Backup by NAKIVO: The Ultimate Solution for VM Data Protection
Favicon
How To Authenticate GCP Cloud Infra using Service Account with IAC Terraform
Favicon
Reproducible and Scalable VM Cloning on Proxmox-Ansible to the Rescue!
Favicon
How to Fix 'WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED' SSH Error in Cloud Environments
Favicon
A Detailed Guide to Securing Proxmox Virtual Machines via NAKIVO Backup & Replication
Favicon
Create And Deploy A Linux Virtual Machine In Azure Using Terraform
Favicon
Dual-Booting vs. Virtual Machines: Maximizing System Resources and Performance
Favicon
Adding short-circuiting in a bytecode interpreter
Favicon
Proxmox Security Series: Strengthening Your Virtual Environment
Favicon
Simplify Your Workflow By Using Virtual Machine on Microsoft Azure
Favicon
Connect to Azure VM w/SSH Through Azure CLI
Favicon
VMSS CREATION AND CONNECTING.
Favicon
Common Causes of Data Loss in Virtual Machines and How to Prevent It
Favicon
How to change the Screen Resolution of a Guest-OS (Ubuntu) in Hyper-V with PowerShell on Windows 11
Favicon
Step-by-Step Guide: How to Create and Connect a Windows 11 Pro Azure Virtual Machine
Favicon
A Simple Guide to Creating Microsoft Azure Resource (Search method)
Favicon
Creating a Linux Virtual Machine with Ubuntu Server using Password Authentication.
Favicon
How to Set Up a PostgreSQL Server on a Virtual Machine
Favicon
HOW TO ADD A DATA DISK TO A VIRTUAL MACHINE
Favicon
ATTACHING A DATA DISK TO AN ALREADY EXISTING WIN 11 PRO VIRTUAL MACHINE IN AZURE
Favicon
Docker Containers vs. Virtual Machines
Favicon
Step-By-Step: How To Create a Linux Virtual Machine In Azure
Favicon
Bare Metal Servers vs. Dedicated Host
Favicon
Isolation as Key: Optimizing Performance in Concurrent Builds on a Single Host
Favicon
GNS3'de Verimliliği Artıran İki Gizli Özellik
Favicon
WSL2 Backup to OneDrive Cloud
Favicon
Provision the VM Instance on GCP
Favicon
Install a VM Instance on GCP
Favicon
QEMU VM with snapshot setup + samba file sharing

Featured ones: