Create a Linux virtual machine in Azure
In this laboratory we will create a Linux virtual machine from the Azure portal. We will take a picture of Ubuntu Server 18.04 LTS from the Azure Marketplace.
Microsoft offers the flexibility to use Windows virtual machines like Linux on Azure.
A great step and approach to the Open Source community and a great commitment from Microsoft CEO Satya Nadella.
We start by step by step.
Creating an Ubuntu Server 18.04 LTS virtual machine
- We create a new resource.
- We look for the Ubuntu Server 18.04 LTS image and select it.
- We start the virtual machine implementation by creating the resource.
The following resource settings have been set for the virtual machine:
- Subscription: we select our Azure subscription.
- Resource group: linuxlab.
- Name of the virtual machine: linuxlab.
- Region: Western Europe.
- Availability options: Not set.
- Image: Ubuntu Server 18.04 LTS.
- Size: We can apply the machine size that most interests you. In this laboratory a standard B2s has been configured (2vCPU, 4 GB of RAM).
- Authentication type: SSH public key. It is also possible to create a username and password.
- Username: userlinux
- SSH public key: To generate the public and private key to access Linux through SSH we use PuTTYgen.
- We generate the key.
- To generate the key it is necessary to move the mouse cursor over the white area shown below.
- We copy the public key and paste it in Azure in the «Public key» field. We configure a KEY PASSPHRASE and store the public and private key. The KEY PASSPHRASE will be the password to access the virtual machine by SSH.
- Log in with Azure Active Directory: Disabled
- Ports of entry to the public: We mark SSH
Disks: We have not created additional disks. By default, the OS hard disk is 128 GB
Networks: We have left the settings that Azure gives us by default.
- Boot Diagnostics: On
- Guest OS Diagnostics: Disabled
- Diagnostic storage account: By default a storage account with a name is created. It can be modified by selecting «Create new».
- Managed identity assigned by the system: Disabled
- Enable auto power off: Off
- Enable backup: Disabled
We leave the default settings
We do not set any label settings
Review and create
Azure will check if we meet all the requirements and the configured data is correct. Once the validation is over, we proceed to create the virtual machine.
Once the creation of the virtual machine and all its associated resources is started, the Azure portal will take us to a summary of the implementation.
Connect to the virtual machine by SSH
We establish the connection to the Ubuntu Server 18.04 LTS virtual machine with PuTTY.
- We open PuTTY. In «Host Name (or IP address)» we introduce our Linux user followed by @ followed by the public IP of our virtual machine.
- We go to the following category: SSH> Auth. In Private key file for authentication we select the private key that was generated with PuTTYgen. Once selected, pressing «Open» will start the connection with the VM and ask us for the KEY PASSPHRASE.