VIRTUAL MACHINES
Tags: webdev, devops, tutorial, career
Published: 2022-10-29 00:04:28

A virtual machine is the virtualization or emulation of a computer system in computing. The functionality of a physical computer is provided by virtual machines, which are built on computer architectures.`


## **CREATING A WINDOWS VIRTUAL MACHINE AND CONNECTING IT WITH RDP**

- Login into your Azure portal.


![Azure Portal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w9bswzj0cmbjjhti0xpm.JPG)


- On search bar, search for virtual machine and click on it.

![Search bar](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nnmteix3pzrzghn6e8yk.JPG)


- Click on create virtual machine (select azure virtual machine).


![create VM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6oh66nh222nq8gdekj9u.JPG)


- Set up your virtual machine to a windows virtual machine and click on review/create.


![Review/create](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uigx2e39yxuhgvhn3c4t.JPG)


## **CONNECTING INTO REMOTE DESKTOP**


- Click on Go to resource.


![Deployed VM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/po9kj9n4j407wfdx38ks.JPG)


- Click on connect, then select RDP.


![RDP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mztww8kk0xla29amfawp.JPG)


- Download the file.


- Open the file on your downloads and type in your login details (the username and password created during the VM setup)



![Login details](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hvvwulk42tb2b2v0zbjb.JPG)


- Click on connect.


- Click on yes to access the remote desktop.

![Access](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lsk0k7aagat0e8x28ahp.JPG)


## **HOW TO INSTALL A WEBSERVER ON THE REMOTE DESKTOP**


- Click on the windows menu on your remote desktop.


![Remote desktop](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gbeymrwv9ocii4v587mz.JPG)


- Search for Windows Powershell and run as an administrator.


- type in

```
Install-WindowsFeature Web-Server
```


![Webserver](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdms8l7oqmgcjqe1iok4.JPG)


## **HOW TO ADD A DISK ON THAT WEBSERVER**


- Go back to your azure portal and open your created virtual machine.


![Virtual machine](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zepl6jl5jvv5tixe2un3.JPG)


- Click on disk on the menu bar and edit to your specification.


![Disk](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2wwotavl0powigk8xbnr.JPG)


- Click on save.


- Open your Remote Desktop


![RDP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x8k1hws3av01pjvlph7t.JPG)


- On your the task bar click on search and type in

```
diskmgmt.msc
```

- Click on OKAY to initialize your disk2


 ![Disk](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g8b0088nh3laep6zvezi.JPG)

- Right-click on disk2 and click on New Simple Volume (follow the process by clicking on next)



![Disk2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0md50sttdbduxlncyt0.JPG)



## **CREATING A LINUX VIRTUAL MACHINE AND CONNECTING IT WITH SSH**


- Login into your Azure portal.


![Azure Portal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w9bswzj0cmbjjhti0xpm.JPG)


- On search bar, search for virtual machine and click on it.


![Search bar](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nnmteix3pzrzghn6e8yk.JPG)


- Click on create virtual machine (select azure virtual machine).


![create VM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6oh66nh222nq8gdekj9u.JPG)


- Set up your linux virtual machine and click on review/create.


![linux](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cwf8p87bxtobdj44c179.JPG)


![linuxM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jwsqz9uykg3dnmkp9v3.JPG)



![LinuxVM deployed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4apcipmhrbuh2o4bav6f.JPG)


- Click on go to resource (to open your VM).


![linux4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uzmw9kvc5nkvzojm2m1w.JPG)


- Click on connect (SSH)


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



- Run powershell as administrator.


- type

```
ssh username@ip address
```


- Click Enter


- Type in your password (used in creating your VM) and click Enter



![linux](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/306asr8iv0w8yj90vbbp.JPG)



## **HOW TO CREATE AZURE COMPUTE GALLERY AND CAPTURE IMAGE OF THAT VIRTUAL MACHINE**

- Go to azure portal, on the search bar type azure compute gallery and click on it.

![gallery](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eyt7w8m9uu1b3o1nkf5m.JPG)

- Click on create (to create gallery)

![gallery creation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ozbutbh58yc98ycbf8p7.JPG)

- Set up your gallery and click on review/create

![gallery review](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cywhxppgpvljf2fuf234.JPG)

- Click on create (to create your gallery)

![create gallery](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ceprnhmh3emhpikyvazb.JPG)

![gallery deployed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xypk03ij7vvpjvpq5yv.JPG)

- Go to your azure portal and open an already created virtual machine

![VMImage creation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1lz9khythv6csq5gzir9.JPG)

- Click on capture

![VMImage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/abujifeq2x5rzelc5gz9.JPG)

- Select your the gallery 

![Image gallery](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bb26ikuzsuk6d4c61xry.JPG)

- Create a VM image definition

![Image definition](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r2vp63d9tf1atpam65hc.JPG)

- Set the version details and click on review/create.

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dm7512sqe1ja7joszr7g.JPG)

- Click on create


![Image desc](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/us973p5yvyle42scf78k.JPG)

![Image desployed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x70kgjutyv4f8jslzmu2.JPG)

- Go to your azure portal and open the gallery you created.

![Imagecaptured](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ljpal0zo463qsx73ysp.JPG)