Deploying a windows 11 VM, Windows Server & a Linux VM
Tags: webdev, beginners, programming, devops
Published: 2024-07-08 01:43:30

Step 1: To access the Azure portal, we must provide our login credentials which includes our username and password.
Step 2: In the "Search resources, services and docs" field, type and click “virtual machines”.
Step 3: Click the “Create” button to start the virtual machine creation process then Create a virtual machine hosted by Azure.
Step 4: Select the appropriate subscription and create a resource group by clicking the create resource group button and giving it a name.

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

Step 5: Give the VM a name and choose either Ubuntu server 20.04 or Windows 11, leave every other thing option as default.

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

Step 6: Create an Administrator Account. We need to a username and a password in case we need to connect to the Virtual Machine
Step 7: Select the inbound port rule as SSH if we selected a Linux VM and RDP if it's a windows VM.

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

Step 8: Check the licensing. By default, this is unchecked, click the box to have it checked.
Step 9: Click “Next” till we get to boot diagnostics in the Monitoring tab, and click on “disable”.
Step 10: Click on “Review + Create” button, if the validation passes, the deployment will go on.

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

Step 11: Once the virtual machine has been deployed, we can access it by clicking on the "Connect" button in the virtual machine blade in the Azure portal.

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

For Windows: Click Native RDP and click on select and wait for configured sign to be displayed on the right hand side and then Download the RDP file.

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

Open the RDP file from  local computer & click on “connect”. Enter the Admin details created during the process of creating the VM.
Click on the “connect” button displayed to initiate connection.

Enter the username and password created for the Admin section.

Wait for the remote pc to be configured.

Open Powershell in the remote pc.

Run the following command to install the IIS role and management tools:
Install-WindowsFeature -name Web-Server -IncludeManagementTools

If you need specific role services, you can specify them using their feature names, such as: Install-WindowsFeature -name Web-Server

You can verify that IIS has been installed by opening a web browser and pasting the ip address of the VM in a browser. 

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

For a Linux Server: Open Powershell.

Log in with the initially created username and password. 

Make sure that you are logged in as root use the command  - sudo su

Type the command -  apt install nginx -y
            apt = is the package manager of nginx
           install = this is a verb and the action that you want the package manager to perform
           nginx = this is what you want to install on the VM
          -y = This is a command that prompts the system to automatically accept anything that requires you to accept a yes or no

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

We can verify this installation by pasting the IP Address of the VM on a browser

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

For AWS: type "EC2" in the search bar and select "EC2" from the dropdown.

Click on the "Launch Instance" button.

Name the server.

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

Choose an Amazon Machine Image (AMI):

In the "Choose an Amazon Machine Image (AMI)" step, select "Ubuntu Server 20.04 LTS"

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

Select an instance type based on your requirements. The "t2.micro" instance is a good option for testing and is eligible for the free tier.

Create a New Key Pair: Enter a key pair name and then use the defaults for the key pair type and private key file format.

Scroll down to the firewall section and check the box next to allow HTTP traffic from the internet.

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

Click "Launch Instance."

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

Connect to Your EC2 Instance: When the terminal opens Make sure that you are logged in as root use the command  - sudo su

Type the command -  apt install nginx -y
            apt = is the package manager of nginx
           install = this is a verb and the action that you want the package manager to perform
           nginx = this is what you want to install on the VM
          -y = This is a command that prompts the system to automatically accept anything that requires you to accept a yes or no

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

We can verify this installation by pasting the IP Address of the VM on a browser

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