Время на прочтение1 мин
Количество просмотров253K
Недавно мы опубликовали пост про новый билд Windows 10 Insider Preview Build 14316, в котором говорилось про подсистему Ubuntu Linux в этой ОС. Нам написали многие пользователи, которые столкнулись с тем, что не смогли сразу обнаружить эту подсистему и запустить командный интерпретатор bash. Действительно, эта подсистема выключена по умолчанию, а ее драйверы LXss.sys и LXCore.sys не располагаются в системной директории (см. WinSxS). Для тех пользователей, которые не смогли разобраться с данной проблемой, мы укажем шаги по включению подсистемы и проверке ее активности.
Для включения подсистемы следует выполнить следующие шаги:
- Активировать режим разработчика (Developer Mode). Без него Windows 10 откажется устанавливать подсистему Ubuntu Linux.
- Включить компонент подсистемы в настройках Windows.
- Установить подсистему (выполняется автоматически.)
Рис. Настройка функций developer по умолчанию, нужно выбрать Developer mode (Start->Settings->Update and security).
Рис. Подтверждаем.
Рис. В том же окне, в поиске набираем «Windows features».
Рис. Ставим галочку напротив «Windows Subsystem for Linux (Beta)».
Рис. Запускаем командный интерпретатор Windows — cmd, набираем bash и дожидаемся установки Linux.
Рис. Появившиеся в системной директории драйверы Linux.
Рис. Активный сервис подсистемы Linux.
To enable the Windows Subsystem for Linux (Beta), open the Control Panel, click Programs and Features, and click Turn Windows Features On or Off in left side bar under Programs and Features. Enable the Windows Subsystem for Linux (Beta) option in the list here and click OK.
How do I enable Microsoft subsystem in Linux?
Enabling Windows Subsystem for Linux using Settings Open Settings. Click on Apps. Under the “Related settings” section, click the Programs and Features option. Click the Turn Windows features on or off option from the left pane. Check the Windows Subsystem for Linux option. Click the OK button.
How do I enable the Windows Subsystem for Linux optional component is not enabled?
The Windows Subsystem for Linux optional component is not enabled: Open Control Panel -> Programs and Features -> Turn Windows Feature on or off -> Check Windows Subsystem for Linux or using the PowerShell cmdlet mentioned at the beginning of this article.
Can Windows Subsystem for Linux access C drive?
WSL will ordinarily mount your hard disks for you automatically in the /mnt directory. You can access the C: drive from under /mnt/c .
How do I enable WSL2?
Install WSL2 on Windows 10 1909 or older Open Start on Windows 10. Search for Turn Windows features on or off and click the top result to open the experience. Check the “Windows Subsystem for Linux” option. Enable WSL on Windows 10. Click the OK button. Click the Restart button.
How do I activate Linux on Windows 10?
Begin typing “Turn Windows features on and off” into the Start Menu search field, then select the control panel when it appears. Scroll down to Windows Subsystem for Linux, check the box, and then click the OK button. Wait for your changes to be applied, then click the Restart now button to restart your computer.
How do I know if wsl2 is enabled?
Checking if the Install Worked The following command will show us what distros we have installed and what version they are on: wsl –list –verbose. # or shorthand. wsl -l -v.
Is WSL as good as Linux?
WSL is great tool, but if you need all the power and features of a Linux system, it would be better to run your Linux instance on a VM instead. If you want to really get the full Linux experience, run Linux as a VM on VMware Player, Oracle VirtualBox, Microsoft Hyper-V or another hypervisor.
How do I add a user in Linux terminal?
How to Add a User to Linux Log in as root. Use the command useradd “name of the user” (for example, useradd roman) Use su plus the name of the user you just added to log on. “Exit” will log you out.
WSL requires fewer resources (CPU, memory, and storage) than a full virtual machine. WSL also allows you to run Linux command-line tools and apps alongside your Windows command-line, desktop and store apps, and to access your Windows files from within Linux.
Is Windows Subsystem for Linux good?
Its not adding much of the good about Linux, while keeping all the bad of NT. Compared to a VM, WSL is a lot more light, as it is basically just a process that runs code compiled for Linux. I used to spin a VM when I needed something done on Linux, but it’s a lot easier to just type bash in a command prompt.
How can I access Linux files from Windows?
Ext2Fsd. Ext2Fsd is a Windows file system driver for the Ext2, Ext3, and Ext4 file systems. It allows Windows to read Linux file systems natively, providing access to the file system via a drive letter that any program can access. You can have Ext2Fsd launch at every boot or only open it when you need it.
How do I access C drive in Linux?
Although it’s straightforward to access the Windows C: drive in Linux, there are alternatives you might prefer. Use a USB drive or SD card to store data. Add a dedicated HDD (internal or external) for shared data. Use a network share (perhaps a NAS box) or USB HDD connected to your router.
Does WSL2 support GUI?
WSL 2 enables Linux GUI applications to feel native and natural to use on Windows. You can now integrate both Windows and Linux applications into your workflow for a seamless desktop experience.
How do I switch from WSL2 to wsl1?
Open PowerShell as Administrator. To set WSL 2 as your default version for new instances, type and run: wsl –set-default-version 2 . To set WSL 1 as your default version for new instances, type and run: wsl –set-default-version 1 . You are done.
Is WSL2 a VM?
WSL 2 uses the latest and greatest in virtualization technology to run a Linux kernel inside of a lightweight utility virtual machine (VM). However, WSL 2 is not a traditional VM experience.
How do I practice Linux on Windows?
Virtual machines allow you to run any operating system in a window on your desktop. You can install the free VirtualBox or VMware Player, download an ISO file for a Linux distribution such as Ubuntu, and install that Linux distribution inside the virtual machine like you would install it on a standard computer.
Can I use Linux on Windows?
Starting with the recently released Windows 10 2004 Build 19041 or higher, you can run real Linux distributions, such as Debian, SUSE Linux Enterprise Server (SLES) 15 SP1, and Ubuntu 20.04 LTS. Simple: While Windows is the top desktop operating system, everywhere else it’s Linux.
Can Windows 10 run Linux?
It is complete Linux system inside Windows 10. Basically, it allows you to run the same Bash shell that you find on Linux. This way you can run Linux commands inside Windows without the needing to install a virtual machine, or dual boot Linux and Windows. You install Linux inside Windows like a regular application.
Download Article
Figure out if your computer is compatible before installing WSL
Download Article
- Checking Compatiblity
- Enabling Developer Mode
- Turning on the Subsystem
- Post-Installation Setup
- Video
- Q&A
- Warnings
- Things You’ll Need
|
|
|
|
|
|
|
Finally! Linux on Windows is here! With an up to date Windows 10 machine, it’s easy to get an Ubuntu Linux subsystem running on your Windows machine. With the Ubuntu subsystem, you will be able to use common Linux tools, such as grep, awk, and sed, on your Windows machine freely without the restrictions of a virtual machine or bulky Unix-like environment.
- Before you start: This article will be doable only if you have already upgraded to the anniversary edition of Windows 10. Learn how to do it here.
Enabling Windows Subsystem for Linux
- Type “turn windows” in the search bar to open a dialog box.
- Wait for the list to load, then check the box next to «Windows Subsystem for Linux (Beta).”
- Click the “OK” button.
- Restart your computer when prompted.
-
Open the Settings app. Press the Start
button and then the Settings gear on the lower-left corner of the menu.
-
Advertisement
-
This will list a bunch of information about your computer.
-
[1]
-
[1]
Advertisement
-
-
-
It’s second from the bottom of the list.
-
-
Windows 10 will display a warning for all of the implications that should be considered before turning Developer Mode on. Carefully read through all of these warnings and then press the Yes button.
Advertisement
-
It can easily be accessed by typing in turn windows in the search bar.
-
-
Scroll down to the bottom of the list to find it.
-
Windows 10 will now start to download a bunch of files.
-
Your computer will display a screen indicating that it’s updating. This is actually Windows 10 setting up the Windows Subsystem for Linux.
Advertisement
-
This is easily done by searching for bash in the search bar.
-
Upon opening for the first time, Windows Bash will prompt you to create a username and password.
- Note that the username and password do not have to be the same as the username the password used to log into your Windows 10 account.
Advertisement
Add New Question
-
Question
I have a 16GB flashdrive. Unfortunately due to formatting error or improper unplugging, it has lost more of its MBS. Now I have a 2.19MB flash instead of a 16GB drive, how can I fix my problem?
If you are using Windows, then use the built in command line utility called diskpart to clean the drive. Alternatively, if you are not confident with using command line utility, then use a third party graphical utility. I recommend one called «Rufus». Rufus is good because it’s relatively easy and convenient to use, and it is pretty much impossible to damage your Windows drive with it.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Video
Thanks for submitting a tip for review!
-
Windows Subsystem for Linux is still very much beta and is prone to breaking and encountering issues. There are several resources available for looking up which programs work and which programs do not work as well as resources for troubleshooting.
Advertisement
Things You’ll Need
- Device running Windows 10 64-bit
References
About This Article
Thanks to all authors for creating a page that has been read 187,134 times.
Is this article up to date?
We need to enable Windows Subsystem for Linux (Beta) which is basically Ubuntu linux on Windows.
1. Before installing the Linux Subsystem, you have to have:
- Windows 10 (Anniversary update or later version)
64-bit installation (can’t run on 32-bit systems)
2. Go to Windows Settings and click on pushbutton to Enable developer mode. It may take 30min or so to install packages. It failed once and retry was successful.
3. Next go to Programs and Features->Turn Windows features on or off. Click the Windows Subsystem for Linux (Beta). Go ahead and reboot if it asks.
Alternatively you can Enable the “Windows Subsystem for Linux” optional feature from command line:
- Open Windows PowerShell as Administrator and run:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
4. Fall Creators Update and later: Install from the Microsoft Store as given in the instructions in https://docs.microsoft.com/en-us/windows/wsl/install-win10
Open the Microsoft Store and choose your favorite Linux distribution.
Here are links directly to the store installers:
- Ubuntu
- OpenSUSE
- SLES
After Launch of the install it will take about 30min and give you a prompt as below:
Installing, this may take a few minutes…
Installation successful!
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: root
Enter new Unix password:
Retype new UNIX password:
passwd: password updated successfully
Default UNIX user set to: root
root@:~#
—————————————————————————————–
Note: If using earlier version of Windows 10 then after the reboot open a Windows command prompt and type bash and type “y” to continue. Chose root as the initial linux userid when prompted.
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\>bash
— Beta feature —
This will install Ubuntu on Windows, distributed by Canonical
and licensed under its terms available here:
https://aka.ms/uowterms
Type “y” to continue: y
Downloading from the Windows Store… 100%
Extracting filesystem, this will take a few minutes…
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: root
Found UNIX user: root
Installation successful!
The environment will start momentarily…
Documentation is available at: https://aka.ms/wsldocs
root@localhost:/mnt/c/Users/#
—————————————————————————————————
5. Bash on Ubuntu on Windows app will show up in Windows Start. Click on it. You will get a bash terminal and Ubuntu will be up and running now.
6. Check the Linux version:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
Note the windows drives are mounted in the Subsystem inside the /mnt directory
cd into your Windows user’s Documents directory:
$cd /mnt/c/Users/youruserid/Documents/
You will now have a running Ubuntu on Windows where you can install any Ubuntu packages. And it takes only couple of GB of space and little bit of cpu so wont slow down your laptop like running a Linux VM on Windows.
You can access this Ubuntu server on Windows using Mobaxterm terminal as below:
Download Mobaxterm if you dont have it and install it and must be version 10.5 or higher. Click on the Session icon and then click on Shell icon. Then select Terminal shell dropdown as Ubuntu Bash (WSL). Select any Startup directory such as c:\ and click ok. Thats all you should be able to see a terminal session on your Ubuntu server to work with just like Putty. For more info see the blog: https://blog.mobatek.net/post/mobaxterm-new-release-9.3/
Published
Введение | |
Различные версии | |
Установка | |
Установка Linux kernel для WSL2 | |
Alias | |
Проверить версию | |
Навигация по директориям из Windows | |
Пароль sudo | |
Ошибки | |
Похожие статьи |
Введение
Официальное название — Windows Subsystem for Linux. Или сокращённо WSL.
WSL предоставляет возможность запуска родных линуксовых утилит в
Windows
.
Это стало возможно 2 августа 2016-го года. Когда в результате сотрудничества Microsoft и Canonical
стало возможным использовать оригинальный образ ОС
Ubuntu
14.04 для
непосредственного запуска поверх WSL множества инструментов и утилит из этой ОС без какой-либо виртуализации.
С 6 мая 2019-го года доступна WSL 2, которая работает на Hyper-V
В этой статье вы узнаете как установить WSL. О том как пользоваться командами
Bash
читайте в статье
«Основы Bash»
Если вам нужно просто выполнять несколько bash команд из-под Windows самым простым вариантом будет не WSL а
установка
Git Bash
Доступные варианты
По состоянию на 2025-й год доступны к установке WSL:
-
Ubuntu
-
Debian
- OpenSuse
- Kali
и другие.
Установка
Запуск установки из PowerShell
wsl —install -d Ubuntu
Installing: Ubuntu
Ubuntu has been installed.
Launching Ubuntu…
Затем должно запуститься окно с
Ubuntu
Installing, this may take a few minutes…
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: andrei
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
Windows Subsystem for Linux is now available in the Microsoft Store!
You can upgrade by running ‘wsl.exe —update’ or by visiting https://aka.ms/wslstorepage
Installing WSL from the Microsoft Store will give you the latest WSL updates, faster.
For more information please visit https://aka.ms/wslstoreinfo
To run a command as administrator (user «root»), use «sudo <command>».
See «man sudo_root» for details.
Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This message is shown once a day. To disable it please create the
/home/andrei/.hushlogin file.
Запуск установки из панели управления
Нажимаем клавишу WIN пишем control и переходим в Панель управления
(Control Panel)
Установка WSL
Программы и Компоненты
(Programs and Features)
Установка WSL
Включение или отключение компонентов Windows
(Turn Windows features on or off)
Установка WSL
OK
Установка WSL
Подсистема Windows для Linux (бета-версия)
(Windows Subsystem for Linux (Beta))
Установка WSL
Ждём
Установка WSL
Перезагрузить сейчас
Установка WSL
После перезагрузки нажимаем сочетание клавиш WIN + R и вводим cmd.
Запуск WSL
В появившейся командной строке пишем bash
Затекм вводим y
Установка WSL
Ждём
Установка WSL
Вводим y если нужен русский язык
Установка WSL
Вводим новое имя пользователя
Установка WSL
Вводим пароль
Установка WSL
Наслаждаемся результатом: теперь для запуска Bash нужно просто ввести эту
команду в командной строке
Установка WSL
Доступ к флешке из Bash в Windows
ls /dev
Установка с сайтов MicroSoft
Когда-то основным сайтом был
aka.ms/wslstore
Возможен редирект на другой сайт MicroSoft
В качестве альтернативы можно найти нужную версию на
apps.microsoft.com
например:
Debian
,
Kali
,
OpenSuse Leap 15.5
,
Ubuntu 22.04
Если у вас откроется aka.ms он возможно будет выглядеть примерно так
Установка WSL
В первых версиях из коробки шла Ubuntu, поэтому сейчас для разнообразия выберем другой вариант
Debian
Установка WSL
На следующем шаге выберем No, thanks
Установка WSL
Нужно дождаться загрузки
Установка WSL
Установка WSL
Введите имя пользователя
Установка WSL
Введите пароль и постарайтесь его не забыть
Установка WSL
Установка WSL2
Нужно скачать WSL2 с сайта
docs.microsoft.com/en-us/windows/wsl/wsl2-kernel
Установка WSL2
Next
Установка WSL2
Finish
Установка WSL2
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 192.168.0.1
nameserver fec0:0:0:ffff::1
nameserver fec0:0:0:ffff::2
Alias
Для ускорения работы можно задать различные алиас.
С точки зрения WSL диск C: находится внутри /mnt
alias andrei=»cd /mnt/c/Users/Andrei»
Проверить версию
Чтобы проверить версию WSL откройте
PowerShell
и выполните
wsl —list —verbose
NAME STATE VERSION
* Debian Stopped 2
docker-desktop Stopped 2
docker-desktop-data Stopped 2
Ubuntu-22.04 Running 2
Навигация по директориям из Windows
Если в адресную строку проводника Windows ввести
\\wsl$
То директории со всеми установленными подсистемами будут видны как обычные папки Windows
Вид из проводника
Вид из проводника
РЕКЛАМА хостинга Beget, которым я пользуюсь более десяти лет
Конец рекламы хостинга Beget, который я всем рекомендую
Пароль sudo
Чтобы задать пароль для sudo закройте WSL и в терминале Windows выполните
wsl -u root
root@FIL41089W:/mnt/c/Users/ADMIN# passwd andrei
New password:
Retype new password:
passwd: password updated successfully
root@FIL41089W:/mnt/c/Users/ADMIN# exit
logout
Снова зайдите в WSL
wsl
Выполните команду с sudo
sudo apt-get update
[sudo] password for andrei:
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
…
Get:38 http://archive.ubuntu.com/ubuntu jammy-backports/multiverse amd64 c-n-f Metadata [116 B]
Fetched 31.1 MB in 4s (8197 kB/s)
Reading package lists… Done
Ошибки
C:\Users\Andrei>bash
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
C:\Users\Andrei>
Автор статьи: Андрей Олегович
Похожие статьи
Windows | |
Terminal | |
PowerShell | |
Loudness Equalization | |
Сеть: Firewall, RDP, SSH, Telnet… | |
Драйверы в Windows | |
Режим разработчика в Windows 10 | |
Git Bash | |
WSL: Windows Subsystem for Linux | |
Системная переменная PATH | |
Установка Windows на gpt диск | |
batch file | |
Удалённый рабочий стол | |
Горячие клавиши | |
BSOD просмотр логов ошибок | |
Точки восстановления системы |