Tag Archive for: Linux distribution

This entry is part 2 of 5 in the series Learning Ansible

This article provides a guide for setting up the Windows Subsystem for Linux (WSL) on a Windows machine. It explains how to install WSL, download a Linux distribution, and set up the preferred distribution (Ubuntu 20.04 in this case). The article also discusses the differences between WSL1 and WSL2 and provides some recommendations for further configuration, such as setting up Visual Studio Code (VSCode) and the Windows Terminal.

Introduction

Windows Subsystem for Linux (WSL) allows users to run a Linux environment on their Windows machines. This can be useful for developers who prefer to work in a Linux environment, as it allows them to use tools like Ansible on their Windows machine without the need for a separate Linux installation.

There are two versions of WSL available: WSL1 and WSL2. WSL1 is the default version and offers the functionality needed for working with ansible. WSL2 offers improved performance and is an option for those who need it.

In this guide, we will go through the steps needed to set up WSL on a Windows machine and install a Linux distribution, specifically Ubuntu 20.04, on top of it.

Installation

  1. Open a Windows command prompt as an Administrator.
  2. Type the following command to install WSL:
wsl --install
  1. Type the following command to list the available distributions and check their status:
wsl --list --online
  1. Set WSL1 as the default version by typing the following command:
wsl --set-default-version 1
  1. Download Ubuntu 20.04 by typing the following command:
wsl --install -d Ubuntu-20.04
  1. Wait for the download to complete.
  2. Restart your PC.

Configuration

  1. Once your machine has restarted, ensure that the WSL kernel is up-to-date by typing the following command:
wsl --update
  1. Shut down WSL by typing the following command:
wsl --shutdown
  1. Open Ubuntu from the Start Menu. This will install the downloaded Ubuntu distribution into WSL and register it with the operating system. You will be prompted to set a password for your Linux environment.

Further Configuration

After setting up WSL and installing a Linux distribution, there are a few additional steps you may want to take to optimize your development environment.

  1. Set up Visual Studio Code (VSCode) and configure it to work with WSL.
  2. Check out the Windows Terminal, a new tool that allows you to work with multiple concurrent terminal windows and link to your Azure account for a seamless cloud shell experience.

For more information on setting up a WSL development environment, see Best practices for setting up a WSL development environment.

Conclusion

By following the steps outlined in this guide, you should now have WSL set up on your Windows machine and have a Linux distribution installed on top of it. This will allow you to work with Linux tools and environments on your Windows machine, making it easier to develop and deploy applications.