WSL for Windows: Embrace the Power of Linux Without Leaving Windows!

As a Windows user in the world of DevOps and cloud computing, you’ve probably found yourself tempted to switch to Linux for its robust capabilities and seamless integration with cloud-native tools. But making the jump from Windows to Linux can feel daunting, especially if you're comfortable with the Windows ecosystem. Enter Windows Subsystem for Linux (WSL)—the perfect middle ground for developers and engineers who want to leverage the power of Linux without giving up Windows! 🎉

In this blog, we’ll dive deep into WSL, exploring why it’s a game-changer for cloud engineers and DevOps professionals. We'll also walk through the steps to install and configure WSL, making it your go-to tool for Linux development and cloud work, all while keeping your beloved Windows OS. Let’s get started!


Why Linux for DevOps and Cloud Engineering?

Linux powers most cloud infrastructure and is essential for DevOps. It supports native tools like Docker, Kubernetes, and Terraform, offers better performance, and has a strong open-source community for security and customization.


Enter WSL: The Best of Both Worlds

WSL lets you run a full Linux environment inside Windows without a virtual machine. It’s lightweight, integrates seamlessly with Windows apps, and provides a realistic Linux experience for cloud development—no need for dual-booting or VMs. WSL 2 also enhances file access and system performance, making it ideal for DevOps tasks.


How to Set Up WSL on Windows

Now that you're convinced about WSL’s advantages, let’s get it up and running! Follow these simple steps to start using Linux on your Windows machine.

1. Enable WSL on Your Windows System

First, we need to enable the WSL feature. Open PowerShell or Command Prompt as an administrator and run the following command:

wsl --install

This command will automatically install WSL and set up Ubuntu (the default Linux distro). If you prefer a different distro, don’t worry—we'll cover that later.

Once installation is complete, restart your computer to finish enabling the feature.

2. Install a Linux Distribution

After the reboot, WSL will be ready, and by default, it installs Ubuntu. However, you can choose another distribution if you want, such as Debian, Kali Linux, or even Fedora. To see all available distros, run:

wsl --list --online

Once you've found your desired distro, install it using the following command:

wsl --install -d <distro_name>

For example, to install Debian, you'd run:

wsl --install -d Debian

3. Set WSL 2 as the Default Version

WSL has two versions: WSL 1 and WSL 2. WSL 2 is recommended because it offers improved performance and full Linux kernel support. To set WSL 2 as your default version, use:

wsl --set-default-version 2

You can also check the version of WSL that a specific distro is using:

wsl --list --verbose

4. Update Your Linux Kernel

Ensure you’re using the latest version of the Linux kernel by running:

wsl --update

This keeps your system up to date with the latest WSL and kernel improvements.

5. Setting Up Your DevOps Environment

Now that WSL is installed, it's time to turn your system into a DevOps powerhouse. Open your distro by typing wsl into the Command Prompt or PowerShell, and you’ll be inside a Linux terminal.

Install Essential DevOps Tools

Let’s install some common tools used in cloud engineering and DevOps:

  • Docker: To run containers inside WSL:

      sudo apt update
      sudo apt install docker.io
    
  • Kubernetes: For container orchestration:

      curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
      chmod +x ./kubectl
      sudo mv ./kubectl /usr/local/bin/kubectl
    
  • Terraform: For infrastructure as code:

      sudo apt update
      sudo apt install terraform
    
Connect WSL to Windows Files

You can easily access your Windows files within the Linux terminal. Just navigate to the /mnt directory to find your Windows drives:

cd /mnt/c

Now you can manipulate Windows files using Linux commands!


Best Practices for Using WSL in DevOps

Here are a few tips to maximize your productivity with WSL:

  1. Use VS Code’s WSL Integration: Visual Studio Code has an extension called Remote - WSL that allows you to use WSL as your development environment, with all the features of VS Code.

  2. Automate Setup with Dotfiles: Use dotfiles (e.g., .bashrc, .vimrc) to customize your WSL environment. This makes sure your tools and settings are always the same no matter which system you're using.

  3. Keep Your System Updated: Regularly update your Linux distribution and WSL to get the latest features and security patches.

  4. Test Cloud Deployments Locally: WSL gives you a local Linux environment to test your cloud deployment scripts and configurations before pushing them live. This helps catch issues early and ensures consistency across environments.


Conclusion: Embrace Linux Power Without Switching!

With WSL, you don’t need to choose between Windows and Linux anymore. You get the flexibility of Linux’s open-source tools and ecosystem while enjoying the convenience of Windows applications. Whether you're building complex CI/CD pipelines, managing cloud infrastructure, or experimenting with new tools, WSL enables you to stay productive in a familiar environment while harnessing the full power of Linux. 💻🌐

Ready to supercharge your Windows machine with Linux? Install WSL today, and take your DevOps and cloud engineering work to the next level. 🚀

0
Subscribe to my newsletter

Read articles from Abhisekh Kumar Rai directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abhisekh Kumar Rai
Abhisekh Kumar Rai