Building Linux subsystem in win10

Time:2020-10-23

The Linux subsystem of win10 is called WSL (Windows subsystem for Linux). The advantage is that the Linux system and windows system are connected, and the isolation phenomenon of the two systems caused by the traditional virtual machine / dual system is changed. The disadvantage is that it is not stable enough, but it is enough for ordinary scientific calculation.

For Linux beginners, WSL is very friendly. It can copy and paste text between two systems. WSL is like an ordinary win10 application. It can carry both ubuntu16.04 and ubuntu20.04 on win10. Some programs do not need to switch between old and new compilers. In addition, WSL is very fast and convenient to build. If the network speed is OK, it will be OK in 5 minutes.

The construction method is divided into four steps: step1: start developer mode; Step2: open Linux subsystem based on win10 system; Step3: install a version of Linux subsystem; Step4: open subsystem and account setting

Step1: open developer mode

Open developer mode in settings, update and security, developer options.

 

 

Step2: open Linux subsystem based on win10 system

Find “start or close windows functions” in the upper left corner of the path “control panel / programs / programs and functions”, open and check “Linux subsystem for windows”.

Control panel open mode: 1. Shortcut key win + R to open “run”, enter control to open. 2. The path is “Settings – applications and functions – programs and functions”. This method can skip the control panel and go directly to “programs and functions”. 3. Find “Windows system / control panel” in the start menu.

 

 

Step 3: to install a version of Linux subsystem, there are 2 methods

Method 1: install ubuntu16.04lts or ubuntu16.04lts or ubuntu20.04lts through the app store. If you can’t install because of regional problems, you need tohttps://account.microsoft.com/profile/Hong Kong or Europe and the United States

Method 2: enter “add appxpackage. / app” from the command line of the PowerShell_ name.appx ”Installation

The reference materials for this step are:https://docs.microsoft.com/zh-cn/windows/wsl/install-manual

Step4: subsystem opening and account setting

Open at the command prompt / PowerShell and type “bash”. (the command prompt can be opened by the shortcut key win + R, and then type CMD; the opening method of the command prompt is to find “windows PowerShell” in the start menu)

The system will prompt you to set the user name. If you want to set the administrator administration, set the user name to root. If you use your own name as an account name, you are an ordinary user. Finally, set the password.

The differences between super users and ordinary users are as follows: 1. With different permissions, ordinary users need to add sudo before apt get to install software, while super users do not. 2. The default installation path is different. The super user is located in the root directory “~ /”, and the ordinary user is located under “/ home / username”. For example, the default installation path of Anaconda in root is’ / root / Anaconda ‘, while the installation path in normal users is’ / home / username / anaconda3′

So far, the WSL has been set up. It is worth noting that win10 can build multiple Linux subsystems at the same time, such as ubuntu16.04 + ubuntu20.04. Some new software can be installed in the higher version of the Ubuntu system, and the old software is installed in the lower version of the Ubuntu system. This can solve the path dependence problem in the process of many software installation.

When using WSL, you just need to type “bash” in the command prompt / shell to use Linux system.

In order to make WSL more convenient, we need to do three steps: 1. Change the system configuration of software installation; 2. Install some basic software; 3. Beautify the system to make the code more enjoyable. Refer to this tutorial:https://www.cnblogs.com/liangxuran/p/13549865.html

 

Add: deletion and shutdown of subsystems

Go back to step 2, find “start or close windows functions” in the upper left corner of the path “control panel / programs / programs and functions”, open and cancel the check of “Linux subsystem for windows”.

Then select restart computer now.

After booting, just go back to step1 and turn off developer mode in settings, update and security, developer options.

Recommended Today

JS function

1. Ordinary function Grammar: Function function name (){ Statement block } 2. Functions with parameters Grammar: Function function name (parameter list){ Statement block } 3. Function with return value Grammar: Function function name (parameter list){ Statement block; Return value; } Allow a variable to accept the return value after calling the function Var variable name […]