Publish: 2019-04-15 | Modify: 2019-12-18
WSL, short for Windows Subsystem for Linux, is a compatibility layer that allows Linux binary executables (in ELF format) to run natively on Windows 10. It is developed by Microsoft in collaboration with Canonical, with the goal of enabling the download and extraction of a pure Ubuntu 14.04 "Trusty Tahr" image on users' local computers, and allowing the tools and utilities within the image to run natively on this subsystem.
To enable the Windows Subsystem for Linux, go to "Programs and Features" - "Turn Windows features on or off" - check the box for "Windows Subsystem for Linux", and then click OK to wait for Windows to install it automatically.
After the installation is complete, you need to restart your computer for the changes to take effect. Once restarted, open the Windows Store, search for "Debian" or "Ubuntu", and then install it.
In this example, xiaoz installed Debian. When you first start WSL, it will prompt you to set up an account and password. Follow the prompts to complete the setup.
Note that the user you set up above does not have root privileges. You can switch to the root user by executing sudo su -
, or use the sudo
command when necessary to run commands that require root privileges.
Many commands are not available in the Linux subsystem and need to be installed using apt-get
. First, execute the command sudo apt-get update
to update the system software, and then execute sudo apt-get install xxx
to install the software.
However, the connection to the Debian official source is very slow in China. Here, you can modify the source to use Netease's source. The operation method is as follows:
# Backup
mv /etc/apt/sources.list /etc/apt/sources.list.bak
vi /etc/apt/sources.list
# Add the following content (163 source)
deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
# Update again
sudo apt-get update
If you need to change to Aliyun's source, use the following content:
vi /etc/apt/sources.list
# Add the following content
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
# Update
sudo apt update
sudo apt upgrade
Windows 10 Subsystem (WSL) can run Linux commands natively, but unfortunately, the window does not support running multiple tabs. However, many third-party software already support setting WSL as the terminal, such as MobaXterm, which allows you to use WSL in a multi-tab environment.
This article refers to Debian Mirror Usage Help for some of its content.
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.