DEV Community

Cover image for Creating a Linux VM and installing nginx on it
Wisdom Benson
Wisdom Benson

Posted on

Creating a Linux VM and installing nginx on it

Step-by-Step Guide to Creating a Linux VM and installing nginx on it

Step 1: Search & Select Virtual Machine on Azure Portal.

Image description

Step 2: Select Create + and click on Azure Virtual Machines.

Image description

Step 3: For Resource Group select Create New, Give your resource group a name and click on OK to save changes.

Image description

Step 4: Provide a Virtual Machine name. Ensure the name is unique and meets the naming requirements.

Image description

Step 5: Select Images & Choose Ubuntu Server 20.04.

Image description

Step 6: Go to the Administrator Account and Create a Username & Password.

Image description

Step 7: In the Inbound port roles, select HTTP & SSH.

Image description

Step 8: Go to Monitoring, Disable Boot Diagnostics.

Image description

Step 9: Click on the “Review + 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.

Image description

Step 10: Once the VM is deployed, find its Public IP Address in the Overview tab.

Image description

Step 11: Open a terminal(like Windows Powershell or use an SSH client like PuTTY) and connect to your VM using SSH

Image description

• 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.

Image description

Step 12: Once connected, run the following commands to ensure the package list is to up-to-date.

apt update

Image description

Step 13: 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).

Image description

Step 14: Test Nginx Installation
• We can verify the installation by pasting the IP Address of the VM in a browser.

Image description

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 customizing NGINX as needed

Top comments (0)