DEV Community

Iniobong Ema
Iniobong Ema

Posted on • Edited on

CREATING AND CONNECTING TO A LINUX VM USING PUBLIC KEY

To create and connect a Linux VM; Sign in to Azure portal @portal.azure.com

Image description

Select "Virtual Machine"
select 'create'
select 'Azure virtual machine'

Image description

Clicking on the azure virtual machine opens up the virtual machine page, where one can create and manage virtual machines.

A new page opens up with options for creating our VM
Step 1: Create a new resource group for the VM or use an existing RG
Step 2: Give the VM a name
Step 3: Select the desired region to deploy the VM
Step 4: Select the availability option, In this case 'no redundancy is
required'
Step 5: The Security type should be 'standard'
Step 6: The image for the VM should be 'Ubuntu' because it is the choice
of linux for this VM

The VM architecture is left at default

(The steps are displayed below)

Image description

Scrolling down;

  1. Select the size of the VM depending on what you want to do
  2. The authentication type is at default "SSH public key"
  3. Create a user name for the Administration account
  4. Select 'Generate a new key pair'

Image description

Scrolling down

  1. Name the key pair Select RSA SSH format
  2. Allow selected ports
  3. Under public inbound ports, select allow selected ports
  4. Select inbound ports (SSH (22)
  5. select 'Review + create'

The process is displayed as shown below

Image description

When the machine is successfully validated, click on 'create' to create the VM

Image description

A pop-up will appear, click 'download the private key and create the resource'

Image description

The private key is then downloaded and the resource is deployed.

Image description

click on "Go to Resource" and copy the public address

Image description

click on 'Connect', 'connect' to connect the VM

Image description

Go to your downloads folder to see the downloaded private key.

using command prompt, open the VM using command prompt using ssh -i filepath administratorusername@IPaddress

to achieve this, first copy the file path name, right click on the file name and copy the path name

Image description

Press Enter key to run and connect to the VM, the VM will then open

Image description

To install the web server, after running the linux vm, in front of the command, type "sudo apt update"

Image description

Image description

To upgrade the linux vm after updating the linux vm, type 'sudo apt upgrade'

Image description

To install the linux vm, on the command prompt, type "sudo apt install engine -y".

To confirm if engine is installed, copy the IP address and paste in a new browser tap, then enter key. you will see "a welcome to nginx' so that everyone with internet access can have access to your public key.

Top comments (1)

Collapse
 
iniobong_ema_92e60ed18028 profile image
Iniobong Ema

Great