How to Create Linux Virtual Machine On Microsoft Azure and Install "Nginx" Server
Published: 2023-12-02 18:02:04

**Introduction**
Azure Linux Virtual Machines (VMs) are a part of Microsoft Azure's cloud computing platform that allows users to deploy and manage Linux-based virtual machines in the Azure cloud environment. These VMs provide flexibility, scalability, and various options for running different Linux distributions, applications, and workloads.

**Procedure to create Azure Virtual Machine**

**Step 1: Sign in to Azure Portal**

Visit the Azure Portal **https://portal.azure.com** and sign in using your Azure account credentials. 
Azure has two means of achieving: 

- Pay-As-You-Go subscription. 
- Free subscription. 

For the sake of learning, it is advisable to choose Free subscription.

**Step 2: Search for Linux Virtual Machine on Web Browser**

On the Azure web browser, search for Virtual Machine

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/okcihqsro3e3rlm8imfs.png)

Click on Create and Select Azure Window Machine

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yd3vk04vk7dosj2h9yt0.png)

**3. Create a virtual machine**

To create the machine, we are going to work on the following Tabs:
Basics, Disks, Networking, Management, Monitoring, Advanced, Tags, Review + create

1. Project details: This contains the Subscription and Resource group. The subscription should be left on default and the Resource group should be created otherwise, the existing one can be selected. In this case, the existing NovemberWorkload is selected.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tjxh4io58qe4e0qnvw1u.png)
2. Instance details:
The selected options are shown on the picture below

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yfel4u57lizyv1gi3pix.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/exzwnb9xi4gejtscoazw.png)

3. Administrator account:
On the Authentication type, Password is selected. This will enable you to create the user ID and password for the virtual machine.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rb7a6bfysu23jdxt39v7.png)

4. Inbound port rules:
On Public inbound ports, click on Allow selected ports
On the Select inbound ports, open ports HTTP(80) and SSH(22).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lle1qvfg4f0du8dv8xti.png)
Note:
1. Port 22 (SSH - Secure Shell):
SSH is a standard protocol used for secure remote access to a server. It provides encrypted communication sessions over an unsecured network and allows users to log in to the VM remotely.
Opening port 22 allows administrators or users to securely connect to the Linux VM using SSH to perform various tasks like configuration, management, software installation, and more.

2. Port 80 (HTTP - Hypertext Transfer Protocol):
Port 80 is the default port for unencrypted web traffic using HTTP. It is used to serve web content such as websites, web applications, or APIs.
By default, Azure might open port 80 to enable users to deploy web applications or host websites on the Linux VM.

**4. Monitoring**
Data, Networking and Management is left on default for now. However, on the Monitoring Tab, Booth Diagnostics is Disable. This is to make the activities seen only within the enterprise and not to the public domain.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6myg6jrck9cbrmcckk5d.png)

**5. Review and Create**
The Advanced and Tags tabs are left on default. The activities is review for correction and it is created on the **Review + Create** tab. Note, it must shown Validation passed to move on


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s78w6mes2cdh0pm7f9jt.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q15yepa74fcver9e69gb.png)

**6. Deployment**
Here you need to allow the deployment to be completed.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sanlm3hgjd9oaziq1496.png)

It is now completed:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gb3w19tzhoav63ij8h1z.png)

Next is to click on Go to Resources

**7. Creation of Virtual Machine and Connection**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hn8z9wrpf16ix69lkd1p.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bonibf8snl5zojto100i.png)

Now, click on **Native SSH**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/05oelxizhckhi8wfiydq.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i5th4igsbmdiizaupizv.png)
You should allow this to show **Configured**

**8. Open powershell on your computer and type in this command**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mdi8qf57mpi060kzzsbu.png)
Click on Run as Administrator

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12xg1jkhs3w2v9tdlbou.png)

ssh username@Ipaddress


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yifwayf9sybn74lc0ica.png)

**9. You need to be in root to continue or do anything on Linux.**

Type in the command

> sudo su

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqh86w5r9oq22iwkutt2.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oxzadat8jtml5p84kqe0.png)

**Type “Y” to continue.**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46z3kyo84k8zq0ylezkx.png)

**Installation is now complete**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hw6i0oupea0unzhku2is.png)

Open your web browser, paste the ip address you copied into the browser and press the enter key to connect to the web server.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1r2jm4v1v0vgvhfbbz4q.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h2whc2wzflga25agcqdk.png)
Hurray, now we have access to the web server


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pj1dt0senel5ft6ezc8f.jpg)