As discussed in the previous resource, setting up a virtual machine (VM) in the cloud is an essential skill for developers, system administrators, and anyone looking to manage applications in a scalable and flexible environment. In this guide, we’ll walk through the process of creating a Linux VM and installing the popular web server, NGINX, on it. Whether you're hosting websites, building applications, or managing network traffic, NGINX is known for its high performance, stability, and low resource consumption. By the end of this guide, you’ll have a fully operational Linux VM with NGINX installed, ready to serve web pages or power your applications. Let's begin!
Step-by-Step Guide to Creating a Linux VM and installing nginx on it
Step 1: Create a New Virtual Machine (VM)
- From the list of search results, click on the Virtual Machine option. The best option is usually highlighted.
Click the Create button to start the virtual machine creation process. Choose Create a virtual machine hosted by Azure.
Select the appropriate subscription and create a resource group by clicking the Create resource group button. Give both the Resource group and the VM a name.
Step 2: Configure the Virtual machine (VM)
Provide other information about your virtual machine, such as the operating system (Ubuntu Server 20.04), size, and other configuration settings. Leave other options as default.
Create an Administrator Account. Use
Azureuser
for the username andpassword123
for the password.
Select Inbound Port Rules. Select SSH if you chose a Linux VM. This allows IP addresses to connect to the VM.
Click Next until you reach the Boot diagnostics in the Monitoring tab, click on Disable, then click Review + Create.
Click on the Create button. If the validation passes, the deployment will proceed. If not, note any recommendations, fix them, and try again. Deployment might take 3-5 minutes.
Step 3: Access the Linux Virtual machine
Once your VM is deployed, find its Public IP Address in the Overview tab.
Open a terminal (like Windows Powershell or use an SSH client like PuTTY) and connect to your VM using SSH:
ssh <username>@<Public-IP-Address>
- Replace and with your VM’s details.
- Enter yes and then your password (not visible while typing in Linux).
- Make sure that you are logged in as root use the command - sudo su.
- sudo su
- Once connected, run the following commands to ensure the package list is up-to-date:
apt update
Step 4: Install nginx on a Linux Server
- Type the command - apt install nginx. 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).
apt install nginx
step 5: Test NGINX Installation
- We can verify this installation by pasting the IP Address of the VM in a browser.
By following these steps, you’ve successfully created a Linux VM in Azure and installed NGINX. This setup is ready to serve web traffic and can be scaled based on your requirements. You can now begin deploying web applications or customizing NGINX as needed.
Thank you for reading my blog.😊😊
If you need further assistance, feel free to reach out in the comment or hit me up on Twitter. You can also follow me on GitHub. My DM's are open and love discussions on cloud topics!😁
Top comments (2)
Welldone!
This was very insightful. Thank you for sharing.