DEV Community

Dendi Handian
Dendi Handian

Posted on • Updated on

Debian in WSL

This post is my journal on trying debian in WSL and playing around with it as starter.

Requirements

  • Having WSL (WSL2) activated

Installing Debian WSL

Open Microsoft Store and search for Debian. Get to install and Open after it installed.

debian wsl microsoft store

It will launch debian program window. Fill the new user and password to use it.

debian wsl first initiation

Download Package Information

sudo apt-get update
Enter fullscreen mode Exit fullscreen mode

debian wsl apt-get update

Checking Debian Version

sudo apt-get install lsb-release
Enter fullscreen mode Exit fullscreen mode
lsb_release -a
Enter fullscreen mode Exit fullscreen mode

checking debian version

Simple Python Server Test in Debian WSL

Installing Python

sudo apt-get install python3
Enter fullscreen mode Exit fullscreen mode

debian wsl installing python

Verifying Python Installation

python3 --version
Enter fullscreen mode Exit fullscreen mode

debian wsl python installation check

Starting a Simple Webserver

Here is the command to start a simple web server in python

python3 -m http.server 8000
Enter fullscreen mode Exit fullscreen mode

python simple web server command

Open the http://localhost:8000 in your browser to confirm if it accessible.

python simple web server UI

Installing Pip (For Further Python Development)

sudo apt-get install python3-pip
Enter fullscreen mode Exit fullscreen mode

debian wsl installing python3-pip

Browse Files in Visual Studio Code

Install the WSL extension

VSCODE WSL extension

After it installed, you can click the arrow-like icon at bottom-left of VSCode

VSCODE SSH icon

And it will open the menu for SSH connections, pick the Connect to WSL using Distro and choose Debian

VSCODE SSH Menu

It will open a new VS Code window and wait a while for the server connection and then you can browse and manage the files inside the WSL Debian through VS Code.

You can close the connection to the WSL later by clicking the same arrow-like icon and choose close connection.

Top comments (0)