Mounted to the specified location subsystem

Original Address: https://www.bilibili.com/read/cv1429071/

Configuring Bash on Windows (WSL) and custom installation location

Learn   2018-11-1 
921 Read 13:00 Comment Like 17

Windows 10 Professional Edition (other versions are not supported) is integrated Bash on Windows features, you can use the Linux command in the default command line directly to handle Windows files, it can also run directly to support only Linux software, this tool programming and simulation aspects are very convenient. How to configure Bash on Windows? Article will be described in detail.

  1. Open Settings -> Security and Updates -> Developer options, select the "Developer mode"

     

Set developer mode

2. Set directly search for "Windows Features", select "Enable Windows features on or off"

Open the Windows Setup dialog box function

3. Check the "Windows subsystem for Linux", and click OK.

Enable function

General process, you need to enter the bash at the command line and follow the prompts to go. However, the official way to install Linux by default the system tray, you can not customize location. So here the use of open source tools, custom installation.

4. Download LxRunOffline: https://github.com/DDoSolitary/LxRunOffline/releases, download files LxRunOffline-vxxxx.zip (you can download the latest version, downloaded the 3.3.0)

5. LxRunOffline extract to a directory, right-click "this computer" -> Properties -> Advanced system settings, select Environment Variables in Advanced panel.

Open environment variable settings dialog

6. Select the Path variable in the System variables, click the Edit button.

7. Click New, and paste just LxRunOffline decompression address to the new project.

Here's directory should contain files LxRunOffline.exe

8. Open a command line, enter LxRunOffline, if the display: [Error] No action is specified, and lists the Help List, the installation was successful. If the display can not find this command, it indicates that the environment variable is set incorrectly.

9. Search Windows Store Linux, choose your favorite distro get up and running, I installed the Ubuntu 18.04 LTS. Follow the prompts steps, fill out the user name and password.

The effect of the first performance

10. Now bash input on the command line, Linux can open a terminal operated.

11. Exit bash, performing LxRunOffline move -n {version} -d {dir}, the Linux moved to the specified directory. Wherein, {version} is the version number, can be viewed by LxRunOffline list, {dir} is the target directory. For example, I do is: LxRunOffline move -n Ubuntu-18.04 -d ./ubuntu

12. Install XServer: Download Xming software https://sourceforge.net/projects/xming/ in.

13. The default option will be downloaded the software can be installed properly, the first time you open the software would be subsequent opens not need to change the default configuration.

14. Enter nano ~ / .bashrc or vi ~ / .bashrc (vi unfamiliar or if Vim, recommended nano, below which there are instructions, corresponding to the Ctrl ^, such as saving a ^ O, is Ctrl + O), the last one line: export DISPLAY =: 0, and save.

15. The input source ~ / .bashrc, just input the activation command.

16. Install a Graphics Software testing: sudo apt-get install vim-gtk.

17. In the case of XMing open, execute: gvim, if all configuration is successful, you can see a graphical interface window.

题外话:Windows自带的CMD在Windows 10中有所加强,然而还是很不好用。因此,建议使用第三方的命令行,例如cmder或者hyper.js等。笔者一直用的cmder。

Guess you like

Origin www.cnblogs.com/Ai-Hen-Jiao-zhi/p/11769594.html