1. Home
  2. Training Library
  3. Demo - Build a Linux Virtual machine in the new portal | ITL3 A2.1 |

Demo - Build a Linux Virtual machine in the new portal | ITL3 A2.1 |

Developed with
QA

Contents

keyboard_tab
Demo - Build a Linux Virtual machine in the new portal | ITL3 A2.1 |
play-arrow
Start course
Overview
DifficultyBeginner
Duration6m
Students61

Description

Now that you've learned how to create a Windows virtual machine, let’s explore how to create a Linux virtual machine. There are only slight differences between the two VMs, and these are mainly in regards to how you connect to the VM itself.

In this video, you'll learn how to build, connect to and log in to a Linux VM in Azure.

Transcript

Now that we’ve learned to build a Windows virtual machine, let’s see if we can build a Linux VM. There are only slight differences mainly in how we connect to the VM itself. To view a list of our current VMs, we select “Virtual Machines” from the left panel, or type “virtual machines” into the search box at the top of the screen. Here you can see our Windows VM. This time let’s click the “Add” button from the top bar. We are now back at the Marketplace or the Azure Image Gallery for VMs which is a subset of the Azure Marketplace. Let’s select “Red Hat Enterprise Linux 7.3.” When you read the description you’ll notice this is a “Pay-As-You-Go Premium Image” which basically just means it carries a separate hourly charge in addition to Microsoft’s own VM rates. I wanted you to see this because unfortunately my current subscription has a spending limit so I will be prevented from creating an OS from this image since it requires a non-trial and a no-spending limit subscription. Let’s go back and search for CentOS. Let’s select CentOS-based 7.3 by Rogue Wave Software (formerly known as OpenLogic). As we’ve done previously, let’s leave the default option of “Resource Manager” and select “Create.”

Once again we’re presented with configuration steps for our VM. We’ll call this VM “Linux1”, keep the disk as SSD and create the same username “cj.” Authenticating to Linux is different than authenticating to Windows. Here we have two options for the Authentication type: an SSH public key which you can generate on Linux/OS X by using ssh-keygen or PuTTYGen on Windows, and we have Password authentication. To use an SSH public key, you’d generate a public key and copy/paste the text for the public key below and reference your private key when connecting, but for our sake we will just go with Password authentication and create a password. Also, let’s use our existing Resource Group “rsGroup1” and the same location “East US.” Click “OK.”

For the VM Size we’ll just use the “DS1 Standard” and click “Select.” In Step 3 we’ll again leave all the default options and if you notice because we are deploying to the same resource group, by default it wants to put our VM on the same Virtual Network and default subnet where it will get an IP address via DHCP on the 10.0.1.0/24 address space. Click “OK”. The summary looks correct so let’s click “OK” to begin deploying our Linux VM.

Now that our Linux VM is complete and running let’s connect to it. We are presented with the same type of “Overview” screen as we’ve had with our Window VM, except now we have a different OS, Public IP, etc. You will also notice we have the same action buttons at the top, including the “Connect” button. When clicking “Connect” the only thing we get is a pop-up messaging saying “To connect to your Linux virtual machine using SSH, use the following command: ssh cj@<ip address>.” If you’re connecting from a Linux machine or OS X you can use the SSH command as is (including referencing your private key file if you’re using SSH keys), but for Windows we have to install a Windows SSH client such as PuTTY.

Here I have PuTTY open. I will put in the public IP address and connect to SSH port 22. I’m also going to name this session and save it so that I may easily reconnect later. Remember, we could have used SSH keys, and had we generated public/private keys we could navigate in PuTTY to Connection -> SSH -> Auth, and browse to the Private Key file. But we are using password authentication so let’s launch the connection. We get prompted to add the VM’s rsa key fingerprint to PuTTY’s cache to say that we trust this machine. Click “Yes.” And now we login with our username and password.

And now we’re connected. You can see the username@host. Let’s run “ifconfig” to see the network details. If you notice we have the 10.0.1.5 internal address from our Virtual Network. Our Windows host has the 10.0.1.4 address. We can even ping the other host. Let’s do that. Ping 10.0.1.4. If you notice, ping fails. That’s because ping uses ICMP, and in Windows Server 2016 ICMPv6 is enabled by default in the firewall rules and ICMPv4 is not. The ping we just did from our Linux VM uses ICMPv4.

Let’s hop back over to our Windows VM. Let’s open PowerShell and do Test-Connection 10.0.1.5 which uses ICMP just like Ping. There we’re able to communicate with our Linux machine. In Server Manager, let’s navigate to Tools -> Windows Firewall with Advanced Security. ICMP are enabled via File and Print Sharing. As you can see File and Print Sharing is disabled for Server 2016, however, you can see ICMPv6 enabled via “Core Networking.” Let’s enable ICMPv4 inbound. Now let’s go back to our Linux VM and try again. There we have it, our Linux VM is able to successfully communicate to our Windows server.