Introduction
I always thought Linux servers were complicated and only for experts. Turns out, setting one up in Azure is pretty straightforward.
This guide shows you exactly how to create a Linux VM in Azure, connect to it from your computer, and run your first commands. No prior Linux experience needed, I also learned as I went!
Step 1: Create a Resource Group
- In azure portal, search Resource group and hit ENTER!
- Name your resource group
- Choose your preferred region (choose one closest to you)
- Click Review and create
Step 2: Start Creating Your Linux VM
- Go to Azure Portal and search for Virtual machines
- Under project details, Select your resource group
Step 4: Set Up Your Login Method and configure Network Access
Here's where it gets interesting. You have two options:
- SSH Key (More Secure)
- Password (Simpler for first timers)
I went with Password because it's less complicated
- Create a username (like adminuser)
- Create a strong password (write it down!)
- Public inbound ports: Select Allow selected ports
- Select inbound ports: Choose HTTP (80) and SSH (22)
- Your configurations are now Validated and your Virtual machine is ready to come alive, click create
Step 6: Verify your VM created and Connect
In your Linux VM resource, you would notice the public IP in the overview tab, This is what you would need to connect. Before connecting, we would need to increase the idle time of our virtual machine
- Click on the Public IP
- Back to the overview page, click Connect
- Once we verify the connection, then we need to connect to our Linux virtual machine. Copy the SSH command
When operating linux, we need to run commands as a root user or add "sudo" to every command. In order to make commands work smoothly, we can change the user to a root user and update our linux server.
- run the command "sudo su"
- run the command "apt update"
apt (Advanced Package Tool) is a powerful, interactive command-line utility for managing software on Debian-based Linux distributions, such as Ubuntu and Linux Mint. It handles installation, removal, upgrading, and dependency management of .deb packages by automating retrieval from online repositories.
- Lastly, install nginx with the command "apt install nginx"
- When prompted, confirm with Y
If everything else is correct, you should be presented with this nice screen here!
You just created and connected to a real Linux server running in Microsoft's datacenter. The same technology that powers Netflix, Spotify, and thousands of companies.
The best part? You can destroy it and create a new one anytime.
Remember: Stop your VM when you're done playing. Future you will appreciate the lower bill!
What did you install on your Linux VM? Share in the comments! And if you got stuck anywhere, let me know; I probably hit the same issue when I started.
SOCIAL SHARE CARD GENERATOR