Below is a step by step guide with screenshots on how to create and connect to a Linux Virtual Machine using a public key
Step 1: Log into Azure Portal.
Proceed to the Azure Portal and use your Azure account to log in.
To create virtual machines (VMs), make sure you have the required rights and a current subscription.Step 2: Type virtual machine in the search bar or click on virtual machine in the Azure services.
Step 3: Click on create as shown below and select Azure Virtual Machine.
Step 5: Create a new resource group and click ok or select already created one from the dropdown. For the purpose of this tutorial, we are creating a new resource group.
Step 7: Select your desired region from the drop down.
Step 8: Select your availability option zone from the drop down. However, for the purpose of this tutorial we choose below as shown in the image.
Step 10: Select Ubuntu Servers 22.04 LTS from the image drop down or from see all images.
- Step 11: Select x64 as VM architecture.
- Step 12: Maintain the default setting which uncheck run with Azure Spot discount.
- Step 13: Select your preferred size.
- Step 14: Maintain the default setting which uncheck enable hibernation.
- Step 15: Select SSH public key for Authentication type.
- Step 16: Set your username as azureuser.
- Step 17: Select Generate new key pair from the drop down as SSH public key source.
- Step 18: Check RSA SSH Format as your SSH Key Type.
- Step 19: Input your key pair name as shown below.
- Step 20: Check Allow selected ports box in the public inbound ports as shown below.
- Step 21: Open the drop down at Select inbound ports and check HTTP (80) and SSH (22) as shown below.
- Step 22: Click on Review + create as shown below to continue.
- Step 23: A page will appear to inform you of validation progress, when validation is passed as shown below, click on create to proceed.
- Step 24: A dialogue box will appear where you will need to download the private key, ensure you note where this file is downloaded in your system.
- Step 25: Wait for few minutes and allow the deployment to initialize, submit and complete. Click on Go to resource as shown below to continue. Copy the public IP address and proceed to the next step.
- Step 26: To connect, search for the command prompt, right click to run as administrator and type ssh space -i space(input file path location by right clicking on the downloaded file, click properties, security and copy the objectname path) space username(Azureuser)@public IP address and click enter to continue.
- Step 27: To update, run at the command prompt by typing sudo (space) apt-get (space)-y (space) update to continue.
- Step 28: To install, run at the command prompt by typing sudo (space) apt-get (space)-y (space) install (space) nginx to continue.
- Step 29: Paste your IP address on the browser which will open the nginx welcome page.
Top comments (0)