Before deploying a virtual machine, we need to create a Resource Group. In Azure, a Resource Group acts as a container that holds all related resources such as virtual machines, networking components, and storage.
Step 1: Create a Resource Group: To create a resource group, type on search box to acces resource group, and create a resource group

After creating the Resource Group, the next step is to configure networking. In Azure, this is done using a Virtual Network (VNet), which provides a private network for your virtual machine.
Before deploying a virtual machine, we need to set up the required networking. In Azure, this is done by creating a Virtual Network (VNet), which allows our VM to communicate securely with other resources.
This leads us to the next step:
Step 2: Create a Virtual Network (VNet): In the Azure portal, search for Virtual Networks using the search bar. Select it, then click on Create to begin setting up a new virtual network.
Select your existing subscription, then choose the Resource Group you created earlier.
Click Next to proceed to the Security tab and leave the default settings unchanged. Continue by clicking Next to the IP Addresses section.
Here, keep the default address space of 10.0.0.0/16, which provides up to 65,536 IP addresses for your virtual network. Delete the default subnet and click next, you can leave the tag blank depends on your choice, review and create your vnet
Step 3: After creating the Virtual Network, open it from the Azure portal. In the left-hand menu, navigate to Settings and select Subnets.
Click on + Subnet to create a new subnet within the virtual network.
Click on +subnet
Give the subnet a name, then set the address range to 10.0.0.0/24.
This subnet mask provides 256 IP addresses.
Finally, click Add to create the subnet.
After setting up the Resource Group, Virtual Network, and Subnet, we are now ready to deploy the Virtual Machine.
These networking components ensure that the VM can communicate securely within the Azure environment
Step 4: Create a Virtual Machine: To deploy our vm we click on the search box in the azure console and click on the virtual machine in the resultof the search
click on create
click on virtual machine
select the created resource group, give it a name, select the region of your choice, (best region closer to the clients)
For Availability Zone, you can select Zone 1 for testing purposes.
Next, choose the operating system for your virtual machine. You can select either Windows or Linux, depending on your use case. For this tutorial, we will proceed with Ubuntu Server 24.04 LTS.
Select the VM size based on your requirements (for training purposes, a smaller size is recommended).
For authentication type, select SSH Public Key for secure access. Then, provide a username for the VM.
Under Inbound port rules, allow public inbound access and select the required ports:
Port 22 (SSH) – for connecting to your VM
Port 80 (HTTP) – for web traffic once Apache is installed, click on next to Disk
Os size should be by choice for training purpose choose 30 gig to incure little or no cost

For the Disk type, you can choose between SSD and HDD.
For cost efficiency during training, select HDD, then click Next.
Networking
Select the previously created Virtual Network (VNet) and Subnet.
Allow public inbound access for required ports, then proceed to the next step.
Management
For simplicity, leave all settings at their default values.
Monitoring
Also leave the monitoring settings as default.
Advanced
Leave all advanced options unchanged.
Tags
You may leave tags blank for this tutorial.
click on create, download key pair from the prompts
Well done our virtual machine have been deployed
Next, we will connect to our Virtual Machine using SSH and install Apache2 on the server.
To begin, open Git Bash or any Linux-based command-line interface (CLI) on your local machine.
SSH into the Virtual Machine
To SSH into our VM, we will use the following steps:
First, locate your .pem file, which is usually in your Downloads folder.
Navigate to the Downloads directory using the command:
cd Downloads
Next, set the correct permissions for your private key file:
chmod 400 file.pem
This ensures that only you have read access to the key file.
Now, connect to your Virtual Machine using the SSH command:
ssh -i file.pem username@publicIP
When prompted, type yes to accept the host key and establish the connection.
welcome to our vm
first before we do anything we need to update and upgrade our virtual machine using below command line
sudo apt update
sudo apt upgrade -y
now let us install our apache2 by following below command
sudo apt install apache2 -y
to start our apache 2 use the below command line
sudo systemctl start apache2
and yesss we just Connect to the VM using SSH. Install Apache2 on the VM.









Top comments (0)