Deploying to Windows 11, Windows Server, and EC2 Instances
Introduction
Deploying virtual machines (VMs) in various environments such as Windows 11, Windows Server, and AWS EC2 is essential for setting up development and production systems. This guide focuses on setting up a Windows 11 VM in Azure, with additional sections covering Windows Server and EC2.
Deploying to Windows 11: Setting Up a Virtual Machine in Azure
Prerequisites
Before proceeding, ensure that:
- You have an Azure account with the necessary permissions to create virtual machines.
- You have selected the appropriate VM size and image for Windows 11.
- You have configured networking and security settings properly.
Creating a Windows 11 Virtual Machine in Azure
- Log into Azure Portal: Go to Azure Portal and navigate to Virtual Machines.
-
Create a New VM:
- Click Create > Azure Virtual Machine.
- Select Windows 11 as the image.
- Choose an appropriate VM size (at least 4 vCPUs and 8GB RAM recommended).
-
Configure Networking:
- Ensure that RDP access is enabled (port 3389).
- Set up a public or private IP as needed.
-
Set Up Disk and Storage:
- Use a managed disk with at least 64GB storage.
-
Create and Deploy the VM:
- Review settings and click Create.
-
Connect to the VM:
- Once deployed, use Remote Desktop (RDP) to connect by entering the public IP and logging in with the configured credentials.
Post-Installation Steps
Once Windows 11 is installed in the VM:
- Install necessary drivers and updates.
- Configure firewall and security settings.
- Set up remote access and enable necessary software.
Conclusion
By following these steps, you have successfully deployed a Windows 11 virtual machine in Azure.
π Deploying a Web Server VM and Installing IIS on Windows
π Step 1: Create a Web Server VM in Azure
Ensure that when creating the VM, you select a Windows Server image.
π» Step 2: RDP into the VM
On Windows:
- Open Remote Desktop Connection (RDP)
- Enter the public IP address of the VM
- Click Connect
- Enter your Admin username & password
- Click OK
β‘ Step 3: Open PowerShell as Administrator
Install-WindowsFeature -name Web-Server -IncludeManagementTools
β Step 5: Verify IIS Installation
π Method 1: Localhost
http://localhost
π Method 2: Public IP Address
http://<your_vm_ip>
π οΈ Troubleshooting
- IIS Not Running?
Start-Service W3SVC
- Can't Access the Web Page?
New-NetFirewallRule -DisplayName "Allow HTTP" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow
- Restart IIS if needed:
Restart-Service W3SVC
π Basic SSH Commands in Azure & Linux
SSH (Secure Shell) allows secure remote access to Linux servers. Below are the essential SSH commands and their usage.
π Basic SSH Syntax
ssh username@hostname_or_ip
-
username
β The user account you want to log in with. -
hostname_or_ip
β The IP address or domain name of the remote server.
π Example 1: SSH with Password Authentication
ssh azureuser@192.168.1.100
π Example 2: SSH with a Private Key (Identity File)
ssh -i /path/to/private/key user@192.168.1.100
π οΈ Troubleshooting Tips
- Permission Denied? Ensure your private key has the correct permissions:
chmod 600 /path/to/private/key
- Connection Timed Out? Check if SSH is enabled and port 22 is open.
π Copying Files Over SSH
scp -i /path/to/private/key localfile.txt user@192.168.1.100:/remote/directory/
Deploying an EC2 Instance in AWS and Installing Nginx
Prerequisites
Ensure you have:
- An AWS account with permissions to create EC2 instances.
- A key pair for SSH access.
Creating an EC2 Instance
- Log into AWS Console: Go to AWS EC2 and navigate to Instances.
-
Launch a New Instance:
- Click Launch Instance.
- Choose Ubuntu as the image (latest LTS version recommended).
- Select an instance type (t2.micro is free-tier eligible).
- Configure networking and security settings (ensure SSH and HTTP access are allowed).
- Assign an existing key pair or create a new one.
-
Launch and Connect:
- Click Launch.
- Once running, connect using SSH:
ssh -i /path/to/private/key ubuntu@your_ec2_ip
Installing Nginx on the EC2 Instance
- Update the package lists:
sudo apt update && sudo apt upgrade -y
- Install Nginx:
sudo apt install nginx -y
- Start and Enable Nginx:
sudo systemctl start nginx
sudo systemctl enable nginx
- Verify Installation:
systemctl status nginx
-
Test in a Web Browser:
- Copy the public IP of the instance and visit:
http://your_ec2_ip
Troubleshooting
- If Nginx is not running:
sudo systemctl restart nginx
- Ensure the firewall allows HTTP traffic:
sudo ufw allow 80/tcp
β Congratulations! π You have successfully set up an EC2 instance and installed Nginx.
Top comments (0)