Have fun with Linux under Windows through WSL

This article is synchronized to https://waylau.com/enable-windows-subsystem-for-linux/

WSL (Windows Subsystem for Linux) is a number of subsystem functions prepared in Windows systems for those familiar with Linux users. In other words, you can perform Linux operations and run Linux programs in a Windows environment. This is a good feature for users who need Windows and Linux dual systems. This article details how to use WSL.

Introduction to WSL

Bash is a very popular command-line shell on Linux/Unix. It is the default command-line shell for Linux distributions such as Ubuntu, RHEL, and Apple's OS X operating system. This is achieved through Windows Subsystem for Linux (WSL), a new Windows 10 feature that lets you run most of Linux's command-line programs natively in Windows.

In fact, in the operating system before Windows 7, there is a POSIX subsystem in order to compile the UNIX program source code into Windows program. Microsoft provides many UNIX tools for the POSIX subsystem, and these tools are based on the POSIX subsystem to directly compile and implement GNU native code. You can also run command-line shells such as C Shell and Korn Shell in this POSIX subsystem. However, the POSIX subsystem has been removed by default in operating systems since Windows 7. If you are interested, you can experience the POSIX subsystem by enabling the "UNIX-based Application Subsystem" in "Turn Windows Features On or Off" in the Windows 7 operating system.

After enabling the WSL feature, if you use Bash, the Windows 10 operating system will download an Ubuntu user-mode image created by Canonical, and then Bash programs and other Linux binaries can run on the Ubuntu image. . In addition, Microsoft also promises to provide more Linux distributions to choose from in the future.

Condition

WSL only provides this feature on Windows 10 and above, so if you want to play WSL, please upgrade your Windows.

Switch to developer mode

Start the WSL function

Check "Windows Subsystem for Linux" to enable the WSL feature.

After confirmation, please restart your computer.

Enter Bash

Enter Bash, and execute "y" according to the prompt. At this time, Linux will be automatically downloaded from the Windows Store (currently, only the Ubuntu system is supported for the time being).

The installation may be interrupted due to network reasons, please repeat the installation or overturn the wall.

Set username and password

After the installation is complete, you will be prompted to set a username and password. When everything is done, you can play like Linux.

Setting up an Ubuntu mirror

Using a mirror, you can speed up the installation of software. Edit the /etc/apt/sources.list file and add the following entries at the top of the file (please make a corresponding backup before operation)

deb http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse

actual combat

I found the source code of a Linux program from the Internet, compiled it, and ran it successfully.

Enter image description

What kind of program, programmers know →_→

References

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324386494&siteId=291194637