Run Linux on Windows with WSL

Windows Subsystem for Linux (WSL)

WSL, or Windows Subsystem for Linux, is a compatibility layer provided by Microsoft for Windows 10 and Windows Server that allows running Linux distributions natively on Windows without the need for virtual machines or dual-boot setups. It provides a way to run Linux command-line tools, utilities, and applications directly on a Windows system.

WSL consists of two distinct versions: WSL 1 and WSL 2.

WSL 1:

This version uses a translation layer to convert Linux system calls into Windows system calls, allowing Linux binaries to run on Windows. It provides good compatibility and allows you to run many Linux tools. However, it has limitations in terms of performance and full compatibility with Linux kernel features.

WSL 2:

This version introduced a more advanced architecture. It includes a lightweight virtual machine running a full Linux kernel. This allows for better performance, improved compatibility with Linux system calls, and support for features like Docker containers. WSL 2 provides a more complete Linux experience within Windows.

With WSL installed, you can choose and install Linux distributions directly from the Microsoft Store, including popular options like Ubuntu, Debian, Fedora, and more. Once a Linux distribution is installed, you can launch it from the Start menu or command line and access a Linux shell environment, where you can use Linux tools, run scripts, and even install and use development frameworks and applications.

WSL has been well-received by developers, as it allows them to work seamlessly across different platforms and leverage the power of both Windows and Linux environments simultaneously.

How to install WSL in windows?

To install Windows Subsystem for Linux (WSL) on Windows 10, you can follow these steps:

  1. Open the Start menu and search for “PowerShell.”
  2. Right-click on “Windows PowerShell” and select “Run as administrator.” This will open an elevated PowerShell window.

Note: If you’re using Windows 11, you can search for “Windows Terminal” instead and launch it as an administrator.

  1. In the PowerShell window, run the following command to enable the Windows Subsystem for Linux feature:
  2. After restarting, open the Microsoft Store by searching for it in the Start menu.
  3. In the Microsoft Store, search for the Linux distribution you want to install, such as Ubuntu, Debian, or Fedora.
  4. Select the desired Linux distribution and click on the “Install” button.
  5. Wait for the installation to complete. It may take some time depending on your internet connection speed.
  6. Once the installation is finished, launch the installed Linux distribution from the Start menu or by searching for its name.
  7. The first time you launch the Linux distribution, it will initialize and ask you to create a new user account and password. Follow the prompts to set up the user account.

To use WSL, you need to enable it on your Windows system. Here’s a general outline of the steps to set up WSL:

  1. Open the Start menu, search for “Turn Windows features on or off,” and open it.
  2. Scroll down and locate “Windows Subsystem for Linux.”
  3. Check the box next to “Windows Subsystem for Linux” and click “OK.”
  4. Windows will apply the changes and may ask you to restart your computer.

Once you have enabled WSL, you can install a Linux distribution from the Microsoft Store or by using the command line. Here’s how you can install Ubuntu from the Microsoft Store:

  1. Open the Microsoft Store.
  2. Search for “Ubuntu” and select the desired Ubuntu distribution.
  3. Click the “Install” button to download and install Ubuntu.

How to Configure WSL for SSH use?

Enabled SSHD for login from remote

$ sudo systemctl enable ssh
$ sudo service ssh restart

Enabled Password based authentication

$ vi /etc/ssh/sshd_config

$ sudo service ssh restart

What are the things you can do in Linux created with a help of WSL

When using Ubuntu through Windows Subsystem for Linux (WSL), you can perform various tasks and utilize a wide range of tools and applications available in the Ubuntu ecosystem. Here are some common things you can do in Ubuntu on WSL:

  1. Run Linux Commands: You can execute Linux commands and utilities directly from the Ubuntu terminal on WSL, just like you would on a regular Linux system.
  2. Install Packages: Ubuntu on WSL allows you to use the APT package manager to install, update, and manage software packages. You can install development tools, programming languages, web servers, databases, and other applications using APT.
  3. Develop and Program: WSL provides a convenient environment for software development. You can write and compile code in programming languages like Python, Java, C++, or JavaScript. Integrated development environments (IDEs) like Visual Studio Code and command-line text editors like Vim or Emacs are available for use.
  4. Access File System: Ubuntu on WSL provides access to the Windows file system, allowing you to work with files and directories seamlessly. You can navigate, create, edit, and delete files using the Ubuntu terminal or graphical file managers like Nautilus.
  5. Network Tools: Ubuntu on WSL includes various network utilities and tools. You can use commands like ping, wget, curl, and ssh to test connectivity, download files, and establish secure shell connections.
  6. Web Development: With Ubuntu on WSL, you can set up a local web development environment. Install web servers like Apache or Nginx, configure databases like MySQL or PostgreSQL, and develop web applications using frameworks like Node.js or Django.
  7. Version Control: Git, a popular version control system, is available in Ubuntu on WSL. You can use Git to track changes in your projects, create branches, and collaborate with other developers using platforms like GitHub or GitLab.
  8. Run Linux Applications: Ubuntu on WSL supports running Linux graphical applications. You can install and launch applications that have a graphical user interface (GUI) using an X server like X410 or VcXsrv.
Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x