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

Installation and simple use of Linux-WSL in Windows system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Windows SubSystem for Linux (WSL) is suitable for Windows subsystem of Linux

Blog: https://blogs.msdn.microsoft.com/wsl/ of the WSL team

Official document of WSL: https://docs.microsoft.com/en-us/windows/wsl/about

  recently needs Linux's shell environment to learn. Previously, CentOS Linux has been installed in a virtual machine and operated through a SSH connection, with the help of SSH software, which is not particularly convenient. I have heard of WSL all the time, but I saw it again today, and I found it very convenient (Microsoft is working with Canonical, the development team of Ubuntu). The support is also good (compared to cygwin and others). I just took notes in the course of using it, so I sorted it out and sent it out.

1. Installation

1.1. Install "Ubuntu"

  searches Windows's app store for "Ubuntu" and installs it.

After   is installed, open the application "Ubuntu" from the start menu. The error "WslRegisterDistribution failed with error:0x8007019e" is prompted, and we also need to enable the "Windows Subsystem for Linux" function option.

1.2. enable the "Windows subsystem for Linux" function

Method 1: turn on or off the Windows function

  start, run, type "appwiz.cpl", open "programs and Features", and click "enable or disable Windows features" on the left

Open the Windows feature and drop down to find the Windows Subsystem for Linux, check it and click OK. Add the Windows subsystem for Linux. After adding, you need to restart the computer before it can take effect.

Opening method 2: Powershell

  opens Powershell as an administrator, type "Enable-WindowsOptionalFeature-Online-FeatureName Microsoft-Windows-Subsystem-Linux" in it, and enter to execute the command.

Restart the computer according to the prompts after the   command is executed.

1.3, run for the first time

It takes about two minutes for   to open the "Ubuntu" application for the first time to initialize the installation of Ubuntu. After installation, you will be prompted to set the user name and password.

After setting the   user name and password, you can use the Linux system in Windows!

2. Easy to use

2.1.Query the release version of Ubuntu

# cat / etc/os-release

2.2. Use of other commands

# python-v / / query the version of python software

# ifconfig eth0 / / query eth0 Nic information

# free-m / / query memory usage

# df-h / / View disk and mount point information

# apt install packagename / / install the package

# grep-v "#" / etc/apt/sources.list / / View the software sources used to install the Ubuntu software

2.3 start ubuntu

In addition to opening   by clicking the icon in the menu, you can also:

2.3.1 run from the command prompt

Enter "ubuntu" at the   command prompt to enter the Ubuntu Linux environment directly and exit through "exit"

2.3.2 run in the run box

Type "ubuntu" in the   run box (Win+R) to run it directly, which should be the same as starting at the command prompt, as long as the environment variable Path variable has the path to the Ubuntu executable file.

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