Azure VM - Introduction
An Azure Virtual Machine (VM) is an on-demand, scalable computing resource deployed on Azure through different methods, gives more control over the computing environment.
It gives you the flexibility of virtualization without having to procure and maintain the physical hardware. However, you still need to maintain the VM by performing specific tasks to fulfil your precise necessities.
Azure VM can be used similar to on-premises dedicated server or an in various ways, such as application development and test promptly, scale up – scale down based on demand as well datacenter extension, etc. Due to different types and sizes like A- series or D – Series, Azure VM gives possibility to accomplish specific workloads or performance optimization etc.
You can create either a Windows Server based or Linux based Azure VM, fully depends on requirement and circumstance. Here we are going to see the way to create Azure Linux based VM – Ubuntu server as well, some hands on activities to connect the server.
Before moving ahead, need to consider few things accurately –
- Name of Azure VM
- Region where VM will be stored
- Image of operating system (Here Ubuntu)
- Size and configuration (CPU, Memory etc.) details
- Authentication method (Here SSH key)
- Other related bits and pieces such as disk, network, IP and monitoring etc.
Ubuntu Server - Introduction
The Ubuntu Server is a part of the larger set of Ubuntu products and operating system developed by Canonical and open source programmers around the world. It works with nearly any hardware or virtualization platform. In fact, it is a server platform that anyone can use for the following (but not limited) tasks -
- Websites and development platform
- FTP and email server
- Database server
- File and print server
- Container deployment
- Cloud services, etc.
One major benefit that makes Ubuntu Server so attractive is it's cost effective. Anyone can download a copy of the latest version of Ubuntu Server and deploy it on as many machines as necessary—at zero cost.
Pre-requisites
- SSH key pair
- Azure subscription, if you don't have an account then sign up for a free Azure account - https://azure.microsoft.com/en-gb/free/
Here an SSH key pair will be used during deployment a Linux virtual machine (VM) running Ubuntu using the Azure portal. You can either use an SSH key generator (PuTTY) or the same can be generated via a bash shell or the Azure Cloud Shell.
STEP - 1
I am going to generate the key pair using Windows PowerShell, below listed commands need to execute –
ssh-keygen -t rsa -b 2048
The above command generates public and private keys with the default name of id_rsa in the ~/.ssh directory, just hit the Enter key without specifying any file name.
Next asking the passphrase, if provided then memorize the same.
The key has been generated and saved under the above default path, need to display the contents of the public key using cat command.
cat C:\Users\m1045767/.ssh/id_rsa.pub
STEP - 3
Login to the Azure portal https://portal.azure.com/
Click ‘+ Create a resource’ from the left hand menu, you will get Ubuntu Server under the Popular tab otherwise can click the Compute link.
If still not able to find out the server, then you can search using the search box above the list of Azure Marketplace resources, select Ubuntu Server 18.04 LTS and click the same.
STEP - 4
Next section would be ‘Create a virtual machine’, post selection of Ubuntu server.
On the Basics tab, under Project Details, make sure the correct subscription is selected and then choose either an existing Resource group or can create a new using Create new.
I am going with earlier created resource group ‘rajresource’.
STEP - 5
Under Instance details, enter a valid Virtual Machine name and choose particular Region, I submitted the name as ‘ubuntuServer’ and left the other defaults.
Azure offers a range of options to manage availability and resiliency for application. We can use availability zones or availability set to protect our data or app from a data center outage or maintenance activity. Currently I am not going to select this option.
Note: If you don’t choose an appropriate region, then system will throw message as –
This size is currently unavailable in this location for this subscription: NotAvailableForSubscription.
STEP - 6
Under Administrator account, select SSH public key, type your user name, then paste your public key into the text box which you have been generated earlier.
STEP - 7
Under Inbound port rules - Public inbound ports, choose Allow selected ports and then select SSH (22) and HTTP (80) from the drop-down. In fact, SSH is required here to connect the Ubuntu server via SSH key.
Next leave the remaining defaults and then click the Review + create button at the bottom of the page.
STEP - 8
On the Create a virtual machine page, post validation success you can see the details about the VM you are about to create.
If you feel each information is fine and ready, then click the Create button. It will take a few minutes for your VM to be deployed.
You will get a notification once the Linux VM is created successfully.
Congratulation, Ubuntu Linux VM is deployed !! 😊, time to connect the Linux VM.
STEP - 9
Move to Linux VM overview dashboard and click the Connect link.
STEP - 10
In the Connect to virtual machine page, keep the default options to connect by IP address over port 22. Copy the SSH connection details from the Login using the VM local account, which will be used to connect the Linux VM using bash shell or cloud shell.
For example, the following SSH connection command indicates our connection to Linux VM.
ssh adminuser@137.135.110.195
STEP - 11
Using the same bash shell you used to create your SSH key pair (like the Azure Cloud Shell or your local bash shell) paste the SSH connection command into the shell to create an SSH session.
You can use the same bash shell through which you generated the SSH key pair or cloud shell to connect the Linux VM.
You will get something ECDSA key fingerprint confirmation, enter Yes to go ahead. Next, you will be prompted for the passphrase which you had entered during the SSH key generation.
Post correct submission the Linux Ubuntu VM will be connected successfully.
In the context of Linux command as well the installation of Apache web server on top of Ubuntu Linux server I have written another post. It deals with some hands on activity with basic but important Linux command, you can visit the post Hands on activity with basic Linux commands and Apache installation.
No comments:
Post a Comment