In a move that surprises tech enthusiasts everywhere, Microsoft has just released a tutorial on how to install Linux. It’s not every day that the creator of the world’s most dominant proprietary operating system starts advocating for an open-source alternative. Microsoft suggests using Windows Subsystem for Linux 2 (WSL 2), a local virtual machine (VM), or even a cloud VM, giving users multiple pathways to explore Linux.

We’ve seen a shift where more than half of the virtual machines (VMs) in Microsoft’s Azure cloud ecosystem now run Linux. It’s a significant change that reflects the growing acceptance of Linux in the traditionally Windows-dominated spaces. This new tutorial highlights how Microsoft is embracing diversity in operating systems, whether you’re using Ubuntu, Debian, or another distribution.
It’s fascinating how we’ve reached a point where installation guidance from Microsoft includes Linux. Our favorite installation methods include using WSL 2, which integrates seamlessly with Windows, providing an efficient way to run Linux applications alongside Windows without the need for complex dual-boot setups.
| Method | Characteristics | Use Case |
| WSL 2 | Integrated with Windows | Light development work |
| Local VM | Full isolation | Testing and development |
| Cloud VM | Scalable resources | Large-scale applications |
This tutorial marks another step towards eliminating the old “you must use our OS” mentality. Microsoft now encourages users to experiment and choose the best tools for their needs. This is not just a symbolic gesture; it’s a practical guide that could benefit many.
Contents
Getting Started with Windows Subsystem for Linux
To harness the power of Linux within your Windows environment, we’ll guide you through choosing the correct version of WSL, installing it on both Windows 10 and Windows 11, and configuring it for optimal performance. Let’s dive right in and unlock the full potential of your system.
Choosing the Right Version of WSL
Selecting between WSL versions can be crucial. Windows Subsystem for Linux (WSL) has two primary versions: WSL 1 and WSL 2.
WSL 1 offers lighter integration with Windows, requiring less CPU and memory usage. It’s a good fit for simpler tasks and those who don’t mind slight performance trade-offs.
WSL 2, however, provides a full Linux kernel which improves system calls compatibility and performance. This version is ideal for more intense workloads and developers who need closer parity with a native Linux environment. Most of us would benefit more from WSL 2 unless our system resources are extremely constrained.
Our recommendation? If your machine can handle it, go with WSL 2 to experience near-native Unix performance on Windows.
Installation Guide for WSL on Windows 10 and 11
Installing WSL on both Windows 10 and Windows 11 is straightforward, albeit with slight variations in commands.
For Windows 10, open PowerShell as an admin and run:
wsl --install
If you’re upgrading from an earlier build, ensure your version is 1903 or later and run:
wsl --set-default-version 2
Windows 11 simplifies the process further. Just search for “Windows Features,” then check “Windows Subsystem for Linux” and “Virtual Machine Platform.” After enabling them, restart your system and you’re good to go.
Regardless of your version, you can install your preferred Linux distribution via the Microsoft Store. Popular choices include Ubuntu, Debian, and Fedora.
Configuring WSL for Optimal Performance
After installation, optimizing WSL can significantly boost efficiency.
First, check and update your distro:
sudo apt update && sudo apt upgrade
Enhance performance by:
- Increasing swap memory: Adjust the
.wslconfigfile in your user directory. - Mounting performance: Store frequently accessed files within the WSL’s file system rather than accessing them through Windows’ file system (
C:\).
To further enhance your productivity, consider integrating with Visual Studio Code using the Remote – WSL extension, making it easy to develop and debug directly in your WSL environment.
By following these steps, we can ensure that our WSL setup is not only functional but also optimized for peak performance.
Integrating Linux into Your Windows Environment
Integrating Linux into your Windows environment can transform your workflow by combining the strengths of both operating systems. This section covers some key aspects to get the most out of this integration.
Leveraging Linux Applications on Windows
To enhance our productivity, incorporating Linux applications into Windows is essential. Thanks to Windows Subsystem for Linux (WSL), we can now seamlessly run Linux binaries without the need for a full-fledged virtual machine.
WSL provides access to an extensive range of Linux distributions directly from the Microsoft Store. Whether you’re a fan of Ubuntu or prefer Fedora, these distributions can be installed and managed effortlessly.
For developers, using PowerShell alongside Linux commands like grep and sed can be a game-changer. It allows us to utilize familiar tools right within our primary development environment.
Moreover, tools like Visual Studio Code and the Linux kernel integration make it easy to debug and run Linux applications natively. This is particularly handy for those working on open source projects or needing to maintain cross-platform compatibility.
Advanced Features and Customization
Incorporating advanced features and customization into your Linux setup with Microsoft’s guidance opens up a world of possibilities. Let’s explore how we can fine-tune our Windows Subsystem for Linux (WSL) setup for an optimized and personalized experience.
Fine-Tuning Your WSL Setup
Optimizing WSL involves configuring it to suit our specific needs. We can enhance performance by tweaking system settings.
First, enabling Virtual Machine Platform optimizes virtualization support and enables compatibility with GUI applications.
For those who need more control, we can implement sudo for Windows, granting administrative privileges similar to those in traditional Linux environments. This helps in executing commands that require elevated rights without constant prompts.
We should not overlook customizing our distributions. We can select a preferred Linux distro from the Microsoft Store or import custom ones. Each distro offers unique benefits, and the choice allows us to meet specific requirements, whether for development, system administration, or general use.
Lastly, tools like VirtualBox provide additional flexibility, allowing us to run multiple environments side-by-side. This can be particularly useful for testing or running isolated applications.
By tailoring these aspects, we craft a WSL setup that stands to meet our needs effectively, combining the best of both Windows and Linux.
Scaling Linux in the Cloud
Deploying and managing Linux in the cloud offers versatility and robust options for scalability. We delve into the specifics of setting up Linux virtual machines in Azure and enhancing security.
Setting up Linux Virtual Machines in Azure
Setting up a Linux VM in Azure is straightforward. We can use either the Azure CLI or Azure PowerShell. For beginners, these tools make the process less daunting. First, we log into our Azure account and create a resource group. This helps organize resources effectively.
az login
az group create --name myResourceGroup --location eastus
Then, we proceed to create a Linux VM using the preferred distribution, such as Ubuntu or CentOS. Specify VM size, storage, and networking configurations to suit our needs.
az vm create \
--resource-group myResourceGroup \
--name myLinuxVM \
--image UbuntuLTS \
--admin-username azureuser \
--generate-ssh-keys
A crucial step is to configure the VM’s network security group to permit SSH access. This command ensures we can remotely manage our VM securely.
az network nsg rule create \
--resource-group myResourceGroup \
--nsg-name myNetworkSecurityGroup \
--name AllowSSH \
--protocol Tcp \
--direction Inbound \
--priority 1000 \
--source-address-prefixes '*' \
--source-port-ranges '*' \
--destination-address-prefixes '*' \
--destination-port-ranges 22 \
--access Allow
Enhancing Security with Cloud-Based Linux Solutions
Cloud-based Linux solutions offer robust security measures. With Azure, we can integrate Azure Security Center to monitor and provide recommendations. Ensuring regular updates and patches is critical. Automation tools like Ansible can help manage this efficiently.
Role-Based Access Control (RBAC) provides another layer of security. By restricting access based on role assignments, we reduce the risk of unauthorized actions. We follow the principle of least privilege to enhance security.
az role assignment create \
--assignee <user-email> \
--role "Virtual Machine Contributor" \
--scope /subscriptions/<subscription-id>/resourceGroups/myResourceGroup
Encrypting data at rest and in transit is essential. Azure Disk Encryption can be applied to VM disks using keys stored in Azure Key Vault. This adds an additional security perimeter.
az vm encryption enable \
--resource-group myResourceGroup \
--name myLinuxVM \
--disk-encryption-keyvault myKeyVault \
--volume-type ALL
Adopting a layered security approach ensures our Linux VMs in the cloud are protected against various threats. Integrating these security practices makes our cloud infrastructure resilient and secure.