How to install wsl2 on windows 11
How to install wsl2 on windows 11
Установка ОС Linux в Windows 11 с использованием WSL 2
На текущий момент ОС MS Windows 11 позволяет запустить следующие дистрибутивы Linux:
В новой версии Windows 11 разработчиками Microsoft упрощен механизм установки компонентов WSL. С использованием лишь одной команды можно установить подсистему Windows для Linux, платформу виртуальной машины, ядро WSL, а также дистрибутив Linux.
Рис.1 Установка WSL
Команда —install позволяет выполнить следующие действия:
Рис.2 Установка WSL
Для каждого установленного дистрибутива Linux в среду Windows создается уникальное имя пользователя и пароль. Уникальная учетная запись будет использоваться для входа в конкретный дистрибутив. Эта учетная запись обладает возможностью брать права администратора Linux.
Рис.3 Создание пользователя и пароля в ОС Ubuntu
Установка определенного дистрибутива Linux ОС MS Windows 11 с использованием WSL2
Рис.4 Список доступных дистрибутивов Linux
Рис.5 Установка Kali Linux
Рис.6 Создание пользователя и пароля в ОС Kali Linux
Несколько способов запуска дистрибутивов Linux
Для последующего запуска установленного дистрибутива Linux можно воспользоваться одним из вариантов:
Рис.7 Запуск ОС Linux
Рис.8 Запуск ОС Linux
Удаление дистрибутивов Linux и отключение компонента Подсистема Windows для Linux
Рис.9 Удаление дистрибутивов Linux
Рис.10 Удаление дистрибутивов Linux
Рис.11 Удаление дополнительных файлов WSL
Рис.12 Компоненты Windows
Чтобы открыть данное окно можно воспользоваться одним из вариантов:
Рис.13 Запуск компонентов Windows
Рис.14 Настройка дополнительных параметров обновлений
Рис.15 Включение параметра Получать обновления для других продуктов Microsoft при обновлении Windows
Ошибка запуска ОС Linux может быть вызвана отсутствием включенной опции поддержки виртуализации в BIOS или UEFI
Если запуск подсистемы Windows для Linux выполняется в виртуальной среде, например с использованием платформы VMware Workstation, то необходимо:
Рис.16 Настройка поддержки виртуализации в VMware Workstation
Выше упомянуты только 2 причины, по которым могут возникнуть проблемы с корректной работой WSL. Другие причины будут рассмотрены в дальнейшем.
How to install Windows Subsystem for Linux 2 on Windows 11/10
WSL 2 or Windows Subsystem for Linux 2 is an iterative update to Windows Subsystem for Linux 1. Being so much better than WSL 1, it is obvious that one must upgrade to WSL 2. That is what we will be checking out in this guide.
How to install Windows Subsystem for Linux 2 on Windows 11/10
1] Enable the Optional feature
In order to enable the WSL Optional feature, open Windows PowerShell with Administrator privileges.
Execute the following command:
If will ask for a confirmation if you want to reboot your computer, hit Y to do it straight away or to reboot it manually, hit N.
2] Install a distro
You can try to download and install a suitable Linux distro for your computer from the Microsoft Store.
3] Enable Virtual Machine Platform optional feature
Open Windows PowerShell as an Administrator and execute the following command:
If it asks for a confirmation, to reboot your computer, hit Y to do it straight away or to do it later, hit N.
4] Configure the installed distro
Finally, we have to configure the installed distro to WSL 2.
Open Windows PowerShell and execute this command to list all the available WSL distros on your computer:
Set the desired distro to WSL 2. execute the following command:
Finally, set the selected distro as default by executing the following command:
You would be experiencing the new seamless and faster experience with Windows Subsystem for Linux.
This new update to the command line utility brings in the new architecture. This will drastically improve the file system performance and the full system call compatibility. This new update is based on virtualization (which is based on Hyper – V) which works on a real Linux kernel.
How do I get WSL 2 on Windows 11/10?
To get WSL or Windows Subsystem for Linux 2 on Windows 11/10 computer, you must have Windows 10 Build 18917 or newer version, and Hyper-V virtualization enabled. Following that, you can follow the aforementioned steps one after one. You need to enable the Optional feature first. Then, you need to install a distribution, allow the Virtual Machine Platform optional feature, and configure the Linux distribution.
How do I get Linux subsystem on Windows 11/10?
How to install wsl2 on windows 11
Your submission was sent successfully! Close
1. Overview
Windows Subsystem for Linux (WSL) allows you to install a complete Ubuntu terminal environment in minutes on your Windows machine, allowing you to develop cross-platform applications without leaving windows.
What you will learn:
Note: For Windows 10 users please refer to our alternative tutorial here.
What you will need:
Note: This tutorial doesn’t cover GPU acceleration which is covered in a tutorial of its own.
2. Install WSL
We saw in the tutorial Install Ubuntu WSL on Windows 10 that WSL can be installed from the command line. In Windows 11, it is also available directly from the Microsoft store as an application. Installation from the store will install the latest version of WSL with all the latest features.
Prerequisites
Make sure the following prerequisites are met before installing:
To check the build number, open the Windows menu by pressing the Windows key, then type about in the search field, as shown in the following screenshot:
And select the line About your PC to launch the System / About page.
The OS build number must be higher than 22000. If it is not, then WSL cannot be installed by following this tutorial. Follow the instructions here instead.
The second prerequisite to verify is the Virtual Platform feature.
Search for Windows features.
Open the control panel and scroll down to Virtual Machine Platform.
After installation of the Virtual Machine Platform component, you must restart Windows 11 before proceeding with the installation of WSL components and an Ubuntu application.
Installation of WSL from the Microsoft Store
WSL components are now available as a preview version directly from the Microsoft Store like other Windows applications.
To install the WSL application from the Microsoft Store, open it and search for Windows subsystem.
Click on the item Windows Subsystem for Linux Preview to open the corresponding application page.
Click on Get to download and install the application.
Upon installation, you can click on Open, but it will not do much since there is no Linux distribution installed.
However, if you really want to open the WSL application without installing a distribution, you’ll see a nice and short help message that you must follow in order to make something useful with WSL:
You can now proceed with the installation of Ubuntu.
3. Download Ubuntu
WSL supports a variety of Linux distributions including the latest Ubuntu release, Ubuntu 20.04 LTS, and Ubuntu 18.04 LTS. You can find them by opening the Microsoft Store app and searching for Ubuntu.
Choose the distribution you prefer and then select Get.
Which version should I choose?
There are three types of Ubuntu releases published to the Microsoft Store:
Ubuntu will then install on your machine.
Once installed, you can either launch the application directly from the store or search for Ubuntu in your Windows search bar.
4. Configure Ubuntu
Congratulations, you now have an Ubuntu terminal running on your Windows machine!
Once it has finished its initial setup, you will need to create a username and password (this does not need to match your Windows user credentials).
Finally, it’s always good practice to install the latest updates with the following commands, entering your password when prompted.
sudo apt update
sudo apt full-upgrade
Press Y when prompted.
5. Install and use a GUI package
On Windows 11, WSL comes with WSLg enabled by default. WSLg allows you to run graphical linux applications.
To check that you have the latest package lists, type:
sudo apt update
Then, start with some basic X11 applications:
sudo apt install x11-apps
To run the xeyes, a “follow the mouse” application, type:
The & at the end of the line will execute the command asynchronously. In other words, the shell will run the command in the background and return to the command prompt immediately.
The first launch of a GUI application takes a few seconds while WSL is initializing the graphics stack. Next executions of GUI applications are much faster.
Leave xeyes opened and run the calculator xcalc with:
When you move the cursor over the calculator, xeyes follows the cursor. This shows that several GUI applications can interact together.
Note that applications running under WSLg display a little penguin at the bottom right corner of their icons in the Windows taskbar. That’s one way you can distinguish applications running on Windows or Ubuntu (besides the window decoration and styling).
Close xeyes and xcalc by pressing the cross icon on the top right corner of each X application window.
Xcalc and xeyes are very basic X Windows applications but there are plenty of choices in the Linux ecosystem corresponding to your needs and available out of the box on Ubuntu.
In the following example, we will use GNU Octave to perform numerical computation.
GNU Octave is software featuring a high-level programming language, primarily intended for numerical computations. Octave helps in solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with MATLAB. [GNU / Octave ]
We will use it to calculate and draw a beautiful Julia fractal. The goal here is to use Octave to demonstrate how WSLg works, not to go through the theory of fractals.
First thing is to install the software like we did for x11-apps, from the terminal prompt run:
sudo apt install octave
Then start the application:
Do not forget the ampersand & at the end of the line, so the application is started in the background and we can continue using the same terminal window.
In Octave, click on the New script icon to open a new editor window and copy/paste the following code:
This code is the function that will calculate the Julia set.
Save it to a file named julia.m. Since it is a function definition, the name of the file must match the name of the function.
Open a second editor window with the New Script button and copy and paste the following code:
This code calls the function defined in julia.m. You can later change the parameters if you want to explore the Julia fractal.
Save it to a file named juliatest.m.
And finally, press the button Save File and Run.
After a few seconds, depending on your hardware and the parameters, a Julia fractal is displayed.
Like Octave, this window is displayed using WSLg completely transparently to the user.
6. Enjoy Ubuntu on WSL!
That’s it! In this tutorial, we’ve shown you how to install WSL and Ubuntu on Windows 11, set up your profile, install a few packages, and run a graphical application.
We hope you enjoy working with Ubuntu inside WSL. Don’t forget to check out our blog for the latest news on all things Ubuntu.
Run Linux GUI apps on the Windows Subsystem for Linux
Windows Subsystem for Linux (WSL) now supports running Linux GUI applications (X11 and Wayland) on Windows in a fully integrated desktop experience.
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.
Install support for Linux GUI apps
Prerequisites
You will need to be on Windows 11 Build 22000 or later to access this feature.
Installed driver for vGPU
To run Linux GUI apps, you should first install the driver matching your system below. This will enable you to use a virtual GPU (vGPU) so you can benefit from hardware accelerated OpenGL rendering.
You can now install everything you need to run Windows Subsystem for Linux (WSL) by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.
Once your machine has finished rebooting, installation will continue and you will be asked to enter a username and password. This will be your Linux credential for the Ubuntu distribution.
You’re now ready to begin using Linux GUI apps on WSL!
For more info check install WSL.
Existing WSL install
If you already have WSL installed on your machine, you can update to the latest version that includes Linux GUI support by running the update command from an elevated command prompt.
Select Start, type PowerShell, right-click Windows PowerShell, and then select Run as administrator.
Enter the WSL update command:
You will need to restart WSL for the update to take effect. You can restart WSL by running the shutdown command in PowerShell.
Linux GUI apps are only supported with WSL 2 and will not work with a Linux distribution configured for WSL 1. Read about how to change your distribution from WSL 1 to WSL 2.
Run Linux GUI apps
Support for GUI apps on WSL does not provide a full desktop experience. It relies on Windows desktop, so installing desktop-focused tools or apps may not be supported. To request additional support, you can file an issue in the WSLg repo on GitHub.
Update the packages in your distribution
Install Gedit
Gedit is the default text editor of the GNOME desktop environment.
To launch your bashrc file in the editor, enter: gedit
Install GIMP
GIMP is a free and open-source raster graphics editor used for image manipulation and image editing, free-form drawing, transcoding between different image file formats, and more specialized tasks.
To launch, enter: gimp
Install Nautilus
Nautilus, also known as GNOME Files, is the file manager for the GNOME desktop. (Similar to Windows File Explorer).
To launch, enter: nautilus
Install VLC
VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files.
To launch, enter: vlc
Install X11 apps
X11 is the Linux windowing system and this is a miscellaneous collection of apps and tools that ship with it, such as the xclock, xcalc calculator, xclipboard for cut and paste, xev for event testing, etc. See the x.org docs for more info.
To launch, enter the name of the tool you would like to use. For example:
Install Google Chrome for Linux
To install the Google Chrome for Linux:
To launch, enter: google-chrome
Install Microsoft Teams for Linux
To install Microsoft Teams for Linux:
To launch, enter: teams
Install Microsoft Edge browser for Linux
Find information on how to install the Microsoft Edge browser for Linux using the command line on the Edge Insider site. Select Get instructions under the Command line installation section of the page.
To launch, enter: microsoft-edge
Troubleshooting
If you have any problem starting GUI applications please check this guide first: Diagnosing «cannot open display» type issues with WSLg
Как установить WSL в Windows 11
Публикация: 2 July 2021 Обновлено: 22 December 2021
Теперь вы можете установить все компоненты WSL с помощью одной команды в Windows 11, и вот как это сделать.
Хотя в Windows 11 установка подсистемы Windows для Linux не является сложным процессом, она требует множества шагов, даже больше, если вы также хотите установить WSL (WSL2) по умолчанию. В Windows 11 Microsoft упростила процесс установки, чтобы сократить количество шагов до одной команды, которая включает компоненты WSL, платформу виртуальной машины и запрашивает перезагрузку.
Кроме того, команда также по умолчанию установит последнюю версию дистрибутива Ubuntu. Если вы предпочитаете другой дистрибутив Linux, есть возможность добавить его в команду. Наряду с быстрым и простым процессом установки есть еще одна новая команда, которая упрощает обновление ядра.
В этом руководстве вы узнаете, как легко установить платформу WSL на свое устройство. Кроме того, мы опишем шаги по обновлению ядра Linux в Windows 11.
Установить WSL в Windows 11
Чтобы быстро установить WSL с помощью командной строки, выполните следующие действия:
Шаг 1: Откройте на выбор «Командную строку», «Windows Терминал» или «PowerShell» от имени администратора с помощью меню Win X или с помощью Поиска в меню «Пуск».
Шаг 2: Введите следующую команду, чтобы установить WSL в Windows 11, и нажмите Enter :
Шаг 3: Перезагрузите компьютер.
При необходимости продолжите установку дистрибутива Linux.
После того, как вы выполните эти шаги, необходимые компоненты Linux будут автоматически установлены в Windows 11, а также в последней версии дистрибутива Ubuntu Linux.
Как установить WSL с определенным дистрибутивом в Windows 11
Если вы хотите использовать другой вариант Linux, команда WSL2 имеет возможность просмотра и выбора другого дистрибутива.
Чтобы установить WSL с нужным вам дистрибутивом в Windows 11, выполните следующие действия:
Шаг 1: Откройте «Пуск» и с помощью Поиска найдите командную строку, кликните правой кнопкой мыши верхний результат и выберите параметр «Запуск от имени администратора».
Шаг 2: Введите следующую команду, чтобы просмотреть список доступных дистрибутивов, и нажмите Enter :
Краткое примечание: на момент написания этой статьи вы можете установить:
Шаг 3: Введите следующую команду, чтобы установить WSL с определенным дистрибутивом в Windows 11, и нажмите Enter :
В команде не забудьте заменить «DISTRO-NAME» на имя дистрибутива, который вы хотите установить, например Debian.
Шаг 4: Перезагрузите компьютер.
При необходимости продолжите установку дистрибутива Linux.
После выполнения этих шагов компоненты подсистемы Windows для Linux 2 будут установлены вместе с указанным вами дистрибутивом Linux.
Обновление ядра WSL в Windows 11
Чтобы обновить ядро WSL до последней версии с помощью командной строки, выполните следующие действия:
Шаг 1: Откройте Пуск. Найдите командную строку, кликните правой кнопкой мыши верхний результат и выберите параметр «Запуск от имени администратора».
Шаг 2: Введите следующую команду, чтобы обновить ядро WSL в Windows 11, и нажмите Enter:
После выполнения этих шагов, если доступно обновление, оно будет загружено и установлено на ваш компьютер.
Откат к предыдущей версии ядра WSL
Общая информация о состоянии установки подсистемы Windows для Linux
Список параметров
Установить WSL с помощью магазина Microsoft Store
Вы также можете загрузить и установить все необходимые компоненты из Microsoft Store. Преимущество использования данного подхода заключается в том, что функция, как и прежде будет работать изолированно от Windows 11, а обновления будут доступны через Microsoft Store.
Чтобы установить WSL из Microsoft Store, выполните следующие действия:
Включите платформу виртуальных машин
Загрузите приложение «Подсистема Windows для Linux»
Перейдите на страницу приложения «Windows Subsystem for Linux».
Кликните кнопку «Получить» и установите приложение WSL из Microsoft Store
После выполнения этих шагов WSL будет установлен в Windows 11, включая поддержку приложений Linux с графическим интерфейсом пользователя.