Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Windows methods and steps for installing and configuring WSL

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

What is WSL?

Quote a passage from Baidu Encyclopedia:

Windows Subsystem for Linux (WSL for short) is a compatibility layer for running Linux binary executables (ELF format) natively on Windows 10. Developed by Microsoft in partnership with Canonical, the goal is to make the pure Ubuntu 14.04 "Trusty Tahr" image downloadable and unzipped to the user's local computer, and the tools and utilities in the image can run natively on this subsystem.

We simply think of it as a Linux environment installed on Windows. The best Linux distribution: Win10 + WSL (funny).

Install WSL

1. Enable or disable the Windows feature

First search the search bar and open "enable or disable the Windows feature" and check the "Windows subsystem for Linux" item. Only when this setting is turned on can WSL be installed properly.

two。 Install WSL

Search Linux in the Microsoft App Store, you can see a series of Linux distributions, according to their own needs to choose their own distribution, here I choose Ubuntu 18.04LTS, download is complete, start, wait for installation to complete, enter the account and password, we get a Linux environment.

3. WSL file location

If you want to view other partitions in Linux, WSL mounts the other drive letters under / mnt.

If you want to view the WSL file location under Windows, the file location is under: C:\ Users\ user name\ AppData\ Local\ Packages\ CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\ LocalState\ rootfs.

Configure WSL

1. Change appearance settin

First of all, let's change the appearance, because the session window color matching of WSL actually depends on the color matching in the color tab in the CMD attribute, the default is too ugly, neither highlighted characters nor clear, seriously affecting the efficiency of development.

This requires the use of an open source CMD color matching tool: ColorTool

After downloading and unzipping, open it to the unzipped path with CMD, then run the following command, and the interface of CMD will change. Choose one that looks good to you.

Colortool.exe-b deuteranopiacolortool.exe-b OneHalfDarkcolortool.exe-b OneHalfLightcolortool.exe-b solarized_darkcolortool.exe-b solarized_light

Then reopen the Ubuntu window and you will find that the color matching has also been modified. If you are not satisfied, you can also open the terminal settings properties interface, fine-tune the font and cursor color, and so on. It is recommended to check "use Ctr+Shift+ Cramp V as a shortcut for copy / paste", set the cursor shape to a solid box and the font to Consolas.

two。 Change sourc

The default apt source of Ubuntu is a foreign source, which is too slow. Here, it is replaced by the source of Aliyun.

a. Copy the backup of the source files first to facilitate later recovery:

Sudo cp / etc/apt/sources.list / etc/apt/sources.list.bak

b. View version information

Lsb_release-c

The code name of Ubuntu 18.04 LTS is: bionic

c. Edit source file

Sudo vim / etc/apt/sources.list

According to the Ubuntu version number, add the appropriate content:

Deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb http:/ / mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

Save and exit.

d. Update and upgrade

Sudo apt-get updatesudo apt-get upgrade

3. Install oh-my-zsh

a. Install zsh

Sudo apt-get install zsh

Set the default shell to zsh

Chsh-s $(which zsh)

After the setting is complete, use the following command to check whether the setting is successful.

Echo $SHELL

b. Install oh-my-zsh

Sh-c "$(curl-fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Or

Sh-c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh-O -)"

When the installation is complete, reopen the terminal and the terminal becomes zsh.

c. Set ys theme

Open the oh-my-zsh configuration file

Sudo vim / .zshrc

Modify the theme color matching to ys

ZSH_THEME= "ys"

Or if you want to experience each theme, just set the theme to "random" (funny).

After saving and exiting, reload the configuration file

Source / .zshrc

4. Install the syntax highlighting plug-in

Git clone https://github.com/zsh-users/zsh-syntax-highlighting.gitecho "source ${(Q -) PWD} / zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" > > ${ZDOTDIR:-$HOME} / .zshrc

For more information, please refer to the GitHub official documentation] (https://github.com/zsh-users/zsh-syntax-highlighting))

Make it effective.

Source / .zshrc

5. Simple configuration of vim

Open the vim configuration file

Vim / .vimrc

Add the following

Colorscheme ron:syntax onfiletype onfiletype plugin onfiletype indent onset sts=4set shiftwidth=4set backspace=2set tabstop=4set showmodeset nuset nohlsearch

6. Install jdk

Download the linux-64 bit package from the oracle official website, extract it to the / usr/local/jvm/ path, add the following statement to .zshrc, and configure the environment variables.

Export JAVA_HOME=/usr/local/jvm/jdk1.8.0_211export JRE_HOME=$ {JAVA_HOME} / jre export CLASSPATH=.:$ {JAVA_HOME} / lib:$ {JRE_HOME} / lib export PATH=$ {JAVA_HOME} / bin:$PATH

Re-take effect

Source / .zshrc

I will think of these for the time being, and I will continue to add new content in the future.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report