DEV Community

Cover image for How to Create Linux virtual machine on Azure SSH into Linux server and install nginx on it.
Raphael Olaniyi
Raphael Olaniyi

Posted on

How to Create Linux virtual machine on Azure SSH into Linux server and install nginx on it.

In this article we will create a linux virtual mirchine, SSH into the Linux server and also install nginx! on the virtual machine.

Lets Begin:

Login On Azure Website Type and Search for Virtual Machine and select Virtual machine

Click on the +create button (virtual machine hosted by Azure )
 +create button

Click on +create on your extreme left
+create

Select Azure Virtual Machine from the options.
Select Azure Virtual Machine

Under project details for resource group click on Create New and give it a name (make it a special name or name of a project)
resource group

Under the Instance give your virtual machine a name of your choice.
virtual machine a name

Select a region of your choice
 region

Select the availability zones (this is dependent on how highly available you want the virtual machine to be you can choose zone1 and zone2 if you want the VM to be highly available and you can choose zone1,zone2 and zone3 if you want your VM to be very highly available its all dependent on your budget, the higher the availability the higher the cost)
availability zones

Because you are creating a Linux VM for image you will select Ubuntu Server
Linux VM for image

For Administrator type Select password (With this you can access your VM with password rather than SSH Public keys)
Select password

Create a User Name and Password of your choice
User Name and  Password

Under select inbound port SELECT HTTP and SSH this will enable us to view our virtual machine as a web page.
SELECT HTTP and SSH

Click on the Monitoring tab and disable boot diagnostic

disable boot diagnostic

Then click on tags tab and tag the VM by putting your name or company name.
tags

Click on create and Review wait for it to validate or show green.
create and Review

Once Validation is passed Select Create
Select Create

Once the deployment is complete, click on Go to Resource
Go to Resource

Click on the ip address to increase the idle timeout
idle timeout

Increase the idle time out to 30min (this is to avoid your VM timing out after 5min )
idle time out to 30min

After you are done with that then click save and hit the X sign on the right.
click save

You have successfully created a Linux Virtual Machine, In other to connect to it or to SSH to it , open the power shell application on your windows laptop and type SSH |space |VM Name|VMipaddress NB there is no space between the VM name and ip address as seen below then click enter
You will be asked if you would like to continue then you type Yes
Then you will be asked for password then type the VM password you created and press Enter NB when you are typing your password it will be invisible that’s how Linux protects its self just keep typing when you are done hit the enter button.
invisible

Once the Password is correct the power shell will connect to the Linux VM after that it will instruct that for you to run command as an administrator you need to be connected as user “Root” you will use the Sudo command to achieve this next is type sudo su and hit Enter
sudo su

After that you are connected as a root “user” then you can now instruct apt to install apt nginx by typing “apt install nginx” then hit Enter
apt install nginx

Now let us confirm if nginx! Was actually installed on the virtual machine, we can do this by going to your Azure site and copy the ip address and paste it on the web page and see the result.

Copy ip address
Copy ip address

Paste the ip address to the browser
 browser

From the result you can see that nginx! Has been successfully installed on the virtual machine.

Top comments (0)