Microsoft Azure: Creating Ubuntu Virtual Machine 2022
→ In this article we will use our first Microsoft Azure Service i.e. Virtual Machines
What is Virtual Machine (VM)?
VM are Virtual Computers that we rent OS and computers from Cloud such as CPU, RAM, Storage, etc
Why Virtual Machines?
→ When we work on a client environment or a product, giving a new system for a new project is complex.
→ Instead, these days companies give access to the cloud — where we can upgrade or downgrade computer configurations based on the need.
→ Within a minute computer is ready to be used. Also, we can delete it at any time.
→ The main advantage is that you get to use the services such as a virtual machine service on a pay-as-you-go model. So you only pay for what you consume. If you don’t need it you don’t need to use the service.
Prerequisites:
Azure Cloud access. We can signup for free in Microsoft Azure from the below link:
Creating Ubuntu Azure Virtual Machine:
Once we are logged in to Azure and reach the home page. If we do not have access follow the below steps:
STEP 1: Click on Create a Resource link. This can be done either from the left menu bar or from the right-hand side as shown below:
STEP 2: In the next step we can choose our favourite OS. Microsoft provides most OS with all possible versions.
→ These are the Operating System list and can also be searched.
Eg1: Windows 11:
Click on Create on Windows 11
Eg2: SQL Server:
Click Create on SQL Server OS
Eg3: Ubuntu:
→ We can choose the latest LTE Ubuntu from the below list.
→ In this video we will install Ubuntu 22.04 LTS version.
→ Click Create button:
→ Select from dropdown. Mostly when lots of version updates will be there. It will display here.
→ We will be redirected to the next page.
STEP 3: Here we enter the Basic details of the servers.
→ Mostly when we have logged in the based initial subscription is a free trial, later will be converted to Pay as you Go Plan
→ Click on Create Resource Group, basically these are OS containers (here Ubuntu container)
eg. demo-resource-group
→ Click Ok after giving the resource name
→ Now here we have Availability Zone options.
→ Suppose we have high traffic server application we can create servers in multiple zones in an Availability zone.
→ For now we can choose No Infrastructure Redundancy required from the dropdown.
→ Here Azure will keep randomly in some of their servers.
→ Click on the Next: Disks button.
STEP 4: Disks: Here we enter storage details and storage plans:
→ Here we basically choose SSD configurations.
STEP 5: Networking: Here we basically add server details — subnet, public IP, etc.
→ Let us keep all the default settings and click the Next: Networking button.
→ Lots of configurations can be done here. If we have chosen multiple zones in the previous step, we can choose the Load balancer.
Load Balancer: This is used simply for distributing the traffic in multiple zones.
→ Click on the Next: Management button
STEP 6: Management:
→ Here we basically add a boot diagnostic method eg. Microsoft Defender, etc for the security layer
→ At present let us proceed to the next step. Click on the Monitoring button.
STEP 7: Monitoring: Keeping default, let us click the Next: Advanced button.
STEP 8: Advanced: Keeping the default setting, let us click Next: Tags
STEP 9: Tags: If we want to give some tag names for recognizing this server. We can enter multiple name-value pair names
eg. name: u22, value: ubuntu 22 LTS
→ Click Review + create button.
STEP 10: Review: This is an important step. Here we review all the configurations — software and hardware chosen:
→ The server charges 0.9366 INR/hour
→ By default in the free plan $200 is credited (somewhere around 14,000 INR)
→ Once reviewed the configuration, we can click Create button.
→ Click the Download private key and create the resource.
→ A .pem file is downloaded and will be redirected to the Virtual Machine (VM) landing page.
.pem file: This is a private file, will be used for connecting SSH for Ubuntu
→ Click on Go to resource button.
Landing Page of VM:
SSH connection in Ubuntu:
→ Here we will connect to a Virtual machine.
→ When we are inside the server, we see details of the server running.
→ Before Connecting with SSH. It is important to understand there are three ways to connect —
a. Remote Desktop Protocol (RDP): This is mainly for Windows OS. An RDP file is downloaded and connected with Windows RDP using that downloaded file. Click here to know more.
b. Azure Bastion: This is basically a fully managed service to connect securely to our Virtual machines. Click here to know more.
c. SSH: This means Secure Shell i.e. Linux secure terminal access.
→ Let's create it step by step. Firstly click that SSH link that will give us the command.
STEP A: Click on Connect → SSH, as shown below:
→ Two steps we need to do. We have downloaded a .pem file.
→ Let us copy the path of the file. We have to write in command.
Right click + Get Info (Linux) or Right click + Properties (Windows)
STEP B: Let us now open Terminal or Powershell in your system:
Giving Permission to .pem file:
sudo chmod 400 <keyname>.pem
STEP 3: Connecting SSH:
→ Copy the below command (point 3). This page we received Click SSH from Connect dropdown.
ssh -i <private key path> azureuser@20.249.20.129
SSH connecting command:
→ Paste the .pem file path
→ Type yes → Enter
→ We are finally inside Azure SSH:
→ We can write all the Ubuntu Linux commands here
eg. sudo apt update
Stopping Virtual Machine after use:
→ As Azure Cloud will charge on per hourly basis, we should stop it when we are not using it.
→ There is a stop Tab button. Clicking it will stop the server.
→ Finally our Ubuntu server is ready and all Ubuntu Linux commands will work.
Closing Thoughts:
In this article, we understood how we can create Virtual Machines in the Azure cloud. This helps us create super easy computer ready with the required OS.
Thank you for reading till the end 🙌 . If you enjoyed this article or learned something new, support me by clicking the share button below to reach more people and/or give me a follow on Twitter and subscribe Happy Learnings !! to see some other tips, articles, and things I learn about and share there.