0 ratings0% found this document useful (0 votes) 50 views7 pagesAzure Linux VM Portal LAB
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
‘22104, 3:37 PM Quickstar - Create @ Linux VM in the Azure poral -Azure Virtual Machines | Microsoft Loam
Quickstart: Create a Linux virtual
machine in the Azure portal
Article + 01/04/2024
Applies to: J Linux VMs
Azure virtual machines (VMs) can be created through the Azure portal. The Azure portal is a
browser-based user interface to create Azure resources. This quickstart shows you how to
use the Azure portal to deploy a Linux virtual machine (VM) running Ubuntu Server 22.04
LTS. To see your VM in action, you also SSH to the VM and install the NGINX web server.
If you don’t have an Azure subscription, create a free account before you begin.
Sign in to Azure
Sign in to the Azure portal
Create virtual machine
1. Enter virtual machines in the search.
2. Under Services, select Virtual machines.
3. In the Virtual machines page, select Create and then Virtual machine. The Create a
virtual machine page opens
4. In the Basics tab, under Project details, make sure the correct subscription is selected
and then choose to Create new resource group. Enter myResourceGroup for the
name.*.
Project detals
Select the subscription to manage deple
lesources and costs. Use
source groups ike folders to organize and:
Resource group * (en) m
Greate new
nitps:/leam microsof.comlen-ustazurevitual-machinesinuxiquck-create-portatabsubunty wr‘rea, 387 Pm. ick - Croat Linux Vin the Azice pot Azure Virtua Machines Merosof eam
5. Under Instance details, enter myVM for the Virtual machine name, and choose
Ubuntu Server 22.04 LTS - Gen2 for your Image. Leave the other defaults. The default
size and pricing is only shown as an example. Size availability and pricing are
dependent on your region and subscription.
Instance details
Ragien* [aes
security ype © (Beas
Azure Spot instance © oO
o (Bait. ves 38 G8 wane
© Note
Some users will now see the option to create VMs in multiple zones. To learn
more about this new capability, see Create virtual machines in an availability
zone.
alas roe (zooms ¥]
(© You con now select itp zones Selecting mile zones wll rate one VM
per zone,
6. On the right side, you see an example summary of the estimated costs. This updates
as you select options that affect the cost, such as choosing Ubuntu Server 22.04 LTS -
Gen2 for your Image.
hitps:leam mierosof. conver-us/azurelvitualmachinesiinuxquick-ceate-poraltabs=ubunty an‘2124, 3:37 PM Quickstar- Create Linux VM in the Azure poral -Azure Viral Machines | Microsoft Learn
Estimated monthly costs © x“
\ Basics $70.08
Virtual machine $70.08
Image $0.00
Ubuntu Server 22.04 LTS
Size $70.08
Standard D2s v5
> Disks $5.28
Estimated monthly cost $75.36
If you want to learn more about how cost works for virtual machines, see the Cost,
optimization Overview page.
7. Under Ad
inistrator account, select SSH public key.
8, In Username enter azureuser.
9. For SSH public key source, leave the default of Generate new key pair, and then
enter myKey for the Key pair name.
‘Administrator account
‘Authentication type public key ©)
Key pairname* mykey E
10. Under Inbound port rules > Public inbound ports, choose Allow selected ports and
then select SSH (22) and HTTP (80) from the drop-down
hitps:leam mierosof. conver-us/azurelvitualmachinesiinuxquick-ceate-poraltabs=ubunty‘22104, 3:37 PM Quickstar- Create @ Linux VM in the Azure poral -Azure Virtual Machines | Microsoft Loam
Inbound port rules
tual m ork pots
fon the Netaerng t=
sible from the publiciteret You can
Public inbound ports * OQ None © Alon se
por
Select inbound ports * _————Ty
A. This wt aiow il adresses to access your vital machine. Thssonly
eccrine esi, acti fof com tc Pct et
{Grete rules tint nboued tfc fo kno Pedeee.
11. Leave the remaining defaults and then select the Review + create button at the
bottom of the page.
12. On the Create a virtual machine page, you can see the details about the VM you are
about to create, When you are ready, select Create.
13. When the Generate new key pair window opens, select Download private key and
create resource. Your key file will be download as myKey.pem. Make sure you know
where the .pen file was downloaded; you will need the path to it in the next step,
14. When the deployment is finished, select Go to resource.
15. On the page for your new VM, select the public IP address and copy it to your
clipboard.
Operating system Linux (ubuntu 1
Size Standard D2s v: ry)
Public IP address 10.111.12.123
Connect to virtual machine
Create an SSH connection with the VM.
1. Ifyou are on a Mac or Linux machine, open a Bash prompt and set read-only
permission on the .pem file using chmod 400 ~/Downloads/mykey.pem. If you are on a
Windows machine, open a PowerShell prompt.
2, At your prompt, open an SSH connection to your virtual machine. Replace the IP
address with the one from your VM, and replace the path to the .pen with the path to
nitps:/leam microsof.comlen-ustazurevitual-machinesinuxiquck-create-portatabsubunty an‘22104, 3:37 PM Quickstar- Create @ Linux VM in the Azure poral -Azure Virtual Machines | Microsoft Loam
where the key file was downloaded.
Console
ssh -i ~/Downloads/mykey.pen azureuser@1.111.12.123
Q Tip
The SSH key you created can be used the next time your create a VM in Azure. Just
select the Use a key stored in Azure for SSH public key source the next time you
create a VM. You already have the private key on your computer, so you won't need to
download anything,
Install web server
To see your VM in action, install the NGINX web server. From your SSH session, update
your package sources and then install the latest NGINX package.
Ubuntu
Bash
sudo apt-get -y update
sudo apt-get -y install nginx
When done, type exit to leave the SSH session,
View the web server in action
Use a web browser of your choice to view the default NGINX welcome page. Type the
public IP address of the VM as the web address. The public IP address can be found on the
VM overview page or as part of the SSH connection string you used earlier.
nitps:/leam microsof.comlen-ustazurevitual-machinesinuxiquck-create-portatabsubunty 57‘22104, 337 PM Quickstar- Create Linux VM in the Azure poral -Azure Virtual Machines | Microsoft Loam
@ee< 0 10.111.12.123 @ o oO
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.
For online documentation and support please refer to nginx.org,
Commercial support is available at nginx.com,
Thank you for using nginx.
Clean up resources
Delete resources
When no longer needed, you can delete the resource group, virtual machine, and all
related resources.
1. On the Overview page for the VM, select the Resource group link.
2. At the top of the page for the resource group, select Delete resource group.
3. A page will open warning you that you are about to delete resources. Type the name
of the resource group and select Delete to finish deleting the resources and the
resource group.
Auto-shutdown
If the VM is still needed, Azure provides an Auto-shutdown feature for virtual machines to
help manage costs and ensure you are not billed for unused resources.
1. On the Operations section for the VM, select the Auto-shutdown option.
2. A page will open where you can configure the auto-shutdown time. Select the On
option to enable and then set a time that works for you.
3. Once you have set the time, select Save at the top to enable your Auto-shutdown
configuration
O Note
ntps:/leam microsof.comlen-ustazurevitual-machinesinuxiquck-creste-portatabsubunty 87‘122124, 337 PM (Quickstart - Create a Linux VM inthe Azure portal -Azure Virtual Machines | Microsoft Leam
Remember to configure the time zone correctly to match your requirements, as (UTC)
Coordinated Universal Time is the default setting in the Time zone dropdown.
For more information see Auto-shutdown.
Next steps
In this quickstart, you deployed a virtual machine, created a Network Security Group and
rule, and installed a basic web server.
To learn more about Azure virtual machines, continue to the tutorial for Linux VMs.
[esr un viatmactine ori]
nitps:/leam microsof.comlen-ustazurevitual-machinesinuxiquck-create-portatabsubunty
a