DEV Community

CHIEMEKA VICTOR EDEBATU
CHIEMEKA VICTOR EDEBATU

Posted on

Deploying an Ubuntu Web Server on Azure and Installing Nginx.

Deploying an Ubuntu Web Server on Azure and Installing Nginx.
Introduction
Cloud computing has transformed the way organizations deploy, manage, and access computing resources. Instead of purchasing and maintaining physical servers, businesses can use cloud platforms such as Microsoft Azure to create virtual machines and host applications and websites efficiently.
In this practical exercise, we will deploy an Ubuntu Web Server on Microsoft Azure and install Nginx, a popular and high-performance web server used to deliver websites and web applications over the internet.
The process involves creating an Ubuntu Virtual Machine (VM) in Azure, configuring the necessary network and security settings, connecting to the server remotely using SSH, and installing and configuring Nginx. Once Nginx is successfully installed, the Ubuntu server will be capable of responding to web requests and displaying a web page through a browser.
This practical exercise provides an important foundation for understanding how cloud infrastructure, Linux administration, networking, and web-server technologies work together. It also introduces essential skills that are highly relevant to a Cloud Engineer or DevOps Engineer, including virtual machine deployment, server configuration, security, and application hosting.
By the end of this exercise, we should have a functioning Ubuntu web server running on Microsoft Azure, with Nginx installed and accessible from the internet.

What Is a virtual machine:
A Virtual Machine (VM) is a software-based computer that runs inside a physical computer or cloud infrastructure. It behaves like a real computer, with its own operating system, CPU, memory (RAM), storage, and network connection, but these resources are provided virtually.

Now, to create a virtual machine, you will need a resource group.
What is a resource group. Resource group is the directory that will house all the files or document needed to deploy the application on a virtual machine.
Steps to create a virtual machine
Step 1: Sign in to Azure
Go to Microsoft Azure Portal and sign in to your Azure account.: Search for Resource Groups
• At the top of the Azure Portal, click the Search bar.
• Type Resource groups.
• Select Resource groups from the search results.
Step 3: Create a Resource Group
• Click + Create.
• Select your Subscription.
• Enter a name for your Resource Group.
For example:
Name: RG-Ubuntu-WebServer
Step 4: Select a Region
Choose a suitable Region, for example:
West Europe or another region recommended by your course/instructor.
Step 5: Review and Create
How the VM was created

Next
Create a virtual network Vnet
On Azure interface, search for virtual network.

  1. Choose a resource group
  2. Give your vnet a name
  3. Fill all applicable logs
  4. Review and create. Create a subnet. On the virtual network Click on subnet
  5. Name it
  6. IP address will be assigned automatically.
  7. Click on create. Create a virtual machine -Search for virtual machine on the Azure search bar. Fill all the log accordingly. Save your username while filling the logs
  8. Choose you memory size.
  9. Network
  10. Security
  11. Monitoring
  12. Click on Review and create

After the following process I have my created virtual machine looking like this

  • Your pem file will be downloaded automatically (this pem key will be needed for your secure shell host (ssh) logon ,on the CLI (command line interface). SSH LOG ON
  • Username
  • .pem
  • Public Ip address Format {ssh -I (your key.pem username@public ip address. NOTE You will need to change modification ie, the CLI and the VM you created will need to have a hand shake, since they re strange to each other.so you first use this command Chmod 600 (your key.pem detail). Then Ssh -I (key.pem details) vmusername@ip address. This wiil log you into the CLI domain.

The steps you followed to update and upgrade Ubuntu.
1 DOWNLOAD YOUR GITBASH CLI
On the GitBash interface,
Navigate to your Download file path, by typing this command.
cd Downloads
next
whoami
this will show you your username
next, I update your packages ie all the pre-installed software that came with my virtual machine.
With this command.
sudo apt update.

Then you upgrade the whole applications that came with the new vm ,by typing this command.
sudo apt upgrade
this will show up while the upgrade is going on

The steps I followed to install Nginx.
On the CLI interface, I simply typed the following command
sudo apt install nginx
then this will show up


After the nginx web application has been installed on my vm, i confirmed the status by running this command.
sudo systemctl status nginx
this will show up


Then to confirm the whole work building a VM and ensuring that its up and running on a web server, I copied my vm ip addresses
Typed it on a google tab like this http://YOUR_VM_PUBLIC_IP.Then the web app showed up like this

what i learned.
In the course of my learning, I was able to understood the following;
I learnt how to build a virtual machine.
I learnt how to navigate through different file paths, on the command line interface.(CLI).
I also learnt how to ssh (secure shell host) into CLI to be able to assess my virtual machine,
how to update and upgrade application on a virtual machine with this command,
sudo apt update.
sudo apt upgrade.

how to install a new applications virtually with sudo apt install (app name)

how the details obtained while creating a virtual machine are useful for logging into a CLI
INTERFACE, in-order to navigate a virtual machine on a web server.
I learn to use some command line, to easily access a web server.
I can investigate my VM with a command. ip addr
I can assess my VM ip address. hostname
I can also identify host name of my VM with this . df -h
CONCLUSION
Conclusion
This lab provided practical experience in deploying an Ubuntu Virtual Machine on Microsoft Azure and configuring it as a web server by installing Nginx. During the exercise, we created a Resource Group, deployed the Ubuntu VM, configured the necessary network settings, connected to the server using SSH, and installed Nginx.
The successful completion of the lab demonstrated how cloud infrastructure can be used to create and manage web servers without the need for physical hardware. It also provided valuable hands-on experience with Azure, Linux, networking, and Nginx, which are essential skills for anyone pursuing a career in Cloud Computing or DevOps Engineering.

Top comments (0)