Create A Linux Virtual Machine/Install Nginx
Tags: virtualmachine, beginners, cloudskills, webdev
Published: 2023-11-24 08:25:25

There are basic steps one need to follow to create a linux virtual machine. The steps are as follows;

## **Step 1** : 

The first thing you need to do is login to the azure portal, search for virtual machine. Click the create button.


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


## **Step 2** : 

Create or use an existing resource group

## **Step 3** :

 Give the virtual machine a name - 'Linuxvm'


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

## **Step 4** : 

Image- choose Ubuntu server

## **Step 5** : 

create your username and password

## **Step 6** : 

Choose a size (standard D2as_v4)


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


## **Step 7**: 

Now move to administrator account.You can choose to either use **ssh public key** or **password** as Authentication type.


## **Step 8** : 

Under Inbound ports - select SSH (22) and HTTP(80)


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



## **Step 9** : 

Move to Monitoring and 'disable' diagnostic. Then click review and create



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


## **Step 10** : 

Validation passed- Click create


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



## **Step 11**: 

Deployment in progress( Give it sometime)


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


## **Step 12** : 

Deployment is completed. Click on "Go to resource"



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


## **Step 13** : 

Click on **connect** and select **Native SSH**


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

wait for validation, also give it some time until it is configured


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


## **Step 14**: 
Open powershell on your computer and type in this command

`ssh username@Ipaddress`

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

Respond **yes** to continue

## **Step 15**: 

Type in your password


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

## **Step 16**: 

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/6epgnkzwlvfzf49k47a7.png)




## **Step 17**:

 Now we install **nginx** with this command (Package manager)
`

> apt install nginx
`


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

 _Yayyyy we have succesfully created a **Linux virtual machine** and installed **nginx**_


## **Step 18** : 

Now we test to make sure of our installation.

Copy your public Ip address and run it on your computer web browser.



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


**Yippee💃 Well done mate.**

**I hope this is of great help to you.**