Время на прочтение2 мин
Количество просмотров59K
Команда разработчиков Kali Linux представила графический интерфейс для подсистемы Windows для Linux (WSL). Решение называется Win-Kex (Windows + Kali Desktop EXperience). Теперь можно запускать популярный дистрибутив для пентеста на ПК с Windows 10 в WSL2 с GUI.
Специалисты портала Bleeping Computer проверили, что это действительно работает. Они опубликовали свою инструкцию по установке и запуску Kali Linux с графическим интерфейсом для подсистемы Windows для Linux (WSL2).
Установка Kali Linux с GUI возможна только на ПК с ОС Windows 10 версии 2004.
На подготовительном этапе необходимо в ОС активировать подсистему Windows для Linux.
Открыть PowerShell (сейчас и далее под администратором) и запустить:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Перезагрузить ПК.
Открыть PowerShell и запустить:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Перезагрузить ПК.
Далее необходимо скачать и установить WSL2.
Потом нужно открыть PowerShell и запустить:
wsl --set-default-version 2
Далее нужно установить Kali Linux из магазина Microsoft Store.
Чтобы поменять тип установки kali-linux с WSL1 на WSL2 нужно в PowerShell запустить:
wsl --set-version kali-linux 2
Далее нужно выполнить установку и запустить Kali Linux.
Потом нужно установить пакет Win-KeX.
sudo apt update && sudo apt install kali-win-kex
или
sudo apt update
sudo apt dist-upgrade
sudo apt install -y kali-win-kex
Можно также установить расширенную сборку Kali Linux.
sudo apt install kali-linux-large
После окончание установки GUI для Kali Linux запускается командой «kex».
Видеоинструкция по установке Kali Linux на ПК с Windows 10 в WSL2 с GUI за 5 минут.
How to Install Kali Linux in Windows Subsystem for Linux (WSL)
Step 1: Enable WSL in Windows 10
To enable WSL in Windows 10, open PowerShell as an administrator and run the following command:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Step 2: Install WSL
To install WSL, open a new PowerShell window as an administrator and run the following command:
Step 3: Set WSL 2 as Default
To set WSL 2 as the default version of WSL, open PowerShell as an administrator and run the following command:
wsl --set-default-version 2
Step 4: Install Kali Linux
To install Kali Linux, run the following command in a PowerShell window:
wsl --install -d kali-linux
Step 5: Install Kali Linux Desktop Environment (Optional)
To install the Kali Linux desktop environment (XFCE), run the following command:
sudo apt install kali-win-kex -y
Or u can use, kali-tweaks to install as per ur requirement.
Step 6: Start Kali Linux Desktop Environment (Optional)
To start the Kali Linux desktop environment (XFCE), run the following command:
Step 7: Install Zsh Shell (Optional)
To install the Zsh shell, run the following command:
Step 8: Set Zsh as the Default Shell (Optional)
To set Zsh as the default shell, run the following command:
Step 8: If you have the space, why not install “Kali with the lot”? (Optional)
Here, run the following command:
sudo apt install -y kali-linux-large
That’s it! You should now have Kali Linux installed in WSL with optional GUI and Zsh shell support. Your computer has now become a lethal weapon! 💣🚀💥
Уже некоторое время в Windows 10 присутствует возможность установить различные дистрибутивы Linux с помощью компонента «Подсистема Windows для Linux» или WSL, однако лишь в виде терминала без графического интерфейса. Начиная с Windows 10 2004 WSL обновился до версии 2.0, благодаря чему появились новые возможности и, в рамках этих возможностей появилась Kali Linux для WSL2 с поддержкой графического интерфейса или Win-Kex.
В этой инструкции подробно об установке графического интерфейса Kali Linux в Windows 10 версии 2004 или новее, а также дополнительная информация, например, о том, как включить русский язык интерфейса в установленной системе.
Установка Kali Linux с графическим интерфейсом в Windows 10
Порядок установки Kali Linux с графическим интерфейсом (GUI) для подсистемы Windows для Linux будет состоять из следующих шагов (напоминаю: необходима версия Windows 10 2004 или новее):
- Включите компонент «Подсистема Windows для Linux». Сделать это можно в Панель управления — Программы и компоненты — Включение или отключение компонентов Windows. После установки перезагрузите компьютер.
- Этот шаг можно пропустить, если у вас включены компоненты Hyper-V, иначе запустите Windows PowerShell от имени администратора (можно сделать через правый клик по кнопке «Пуск» и выполните команду
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- Скачайте и установите обновление ядра Linux WSL2 со страницы https://docs.microsoft.com/ru-ru/windows/wsl/wsl2-kernel
- Перезагрузите компьютер, запустите PowerShell от имени администратора и выполните команду
wsl --set-default-version 2
- Зайдите в магазин приложений Windows Store, используйте поиск чтобы найти и установить Kali Linux.
- После завершения установки в PowerShell от имени администратора выполните команду:
wsl --set-version kali-linux 2
- Запустите Kali Linux (пункт будет доступен в меню «Пуск»), выполните первоначальную настройку (имя пользователя и пароль), после чего по порядку выполните следующие команды (требуется подключение к Интернету, последний шаг может занять много времени.
sudo apt update sudo apt dist-upgrade sudo apt install -y kali-win-kex
- В ходе выполнения последней команды вам будет предложено выбрать клавиатуру. Я оставил значения по умолчанию, но, возможно, стоило выбрать русскую, так как в дальнейшем при включении русского языка интерфейса в ряде случаев кириллица не отрисовывается (не знаю, есть ли связь, лишь предположение).
- По завершении установки введите команду kex для запуска Kali Linux с графическим интерфейсом. При первом запуске вам будет предложено создать отдельный пароль, можно от этого отказаться.
В результате запустится Kali Linux с графическим интерфейсом в полноэкранном режиме. Для выхода из полноэкранного режима можете вызвать меню клавишей F8 и отключить опцию «Full Screen».
Если вам потребуется включить русский язык интерфейса для Kali Linux, у меня сработал следующий метод:
- В графическом интерфейсе Kali Linux запускаем терминал, вводим команду
sudo dpkg-reconfigure locales
- Выбираем ru_RU UTF-8 на двух экранах (отметку ставим пробелом, переключаемся на кнопку Ok клавишей Tab).
- Закрываем окно терминала и окно графического интерфейса, в терминале из которого мы запускали графический интерфейс вводим kex stop (если приглашение ввода не отображается, попробуйте изменить размер окна — у меня встретился такой баг).
- Снова запускаем kex — в результате интерфейс будет на русском языке.
А в целом, хотя я еще и не придумал, для чего мне это использовать (возможно, попробую запускать пакеты от bitnami для экспериментов с сайтами), но на первый взгляд всё работает исправно и быстро: быстрее, чем в виртуальной машине.
Install Kali Linux Desktop on Windows with WSL2
Linux in Windows 10 and 11 with Kali Linux Desktop – Win-KeX (“Windows Kali Desktop EXperience”), starting with feature update 2004 there is an XFCE GUI on the Windows desktop.
Win-KeX provides a Kali Desktop Experience for Windows Subsystem for Linux (WSL 2) with the features that support two dedicated modes.
Win-KeX window mode kex –win is the classic appearance in a window for the Kali Linux desktop.
Win-KeX SL mode kex –sl provides the seamless integration of Kali Linux into the Windows desktop with the Windows Start menu below and the Kali panel at the top of the screen. All applications start in their own windows that use the same desktop as Windows applications.
Win-KeX Features
Win-KeX SL Seamless
Sound support
Support multiple sessions
Run Win-KeX as root
Shared clipboard cut and paste content between Kali and Windows Apps
To install Kali Linux on Windows, Open PowerShell as administrator and run the command bellow.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Restart the computer now.
Back after reboot run the commands from PowerShell as administrator.
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft Windows subsystem Linux /all /norestart
Restart the computer again.
Then download Windows Subsystem for Linux 2 (WSL 2) and run the Update Setup Wizard. Download the latest package here and choose WSL2 Linux kernel update package for x64 machine.
Run the next command from the PowerShell as administrator.
wsl --set-default-version 2
Install Kali Linux from the Microsoft Store.
Kali Linux is a Debian-based Linux distribution that mainly includes penetration testing and digital forensics. Kali Linux is primarily aimed at professional and advanced users.
Now complete the initial setup and launch Kali Linux.
Debian is also available from Microsoft Store.
Debian for Windows Subsystem for Linux
Install Win-KeX
Win-KeX from the terminal as follows.
sudo apt update && sudo apt install -y kali-win-kex
Start Win-KeX
Win-KeX can be run in window mode or Seamless mode. Win-KeX in window mode as follows.
kex --win
Start Win-KeX in Seamless – Sameless mode.
kex --sl
Win-KeX Start Examples
kex - Desktop full screen
kex --win - Desktop Window
kex --sl - Desktop Seamless Mode
kex --sl -s - Desktop Seamless Mode with Sound
kex --sl --wtstart - KeX server and win-kex client in terminal
kex --esm - KeX desktop in native RDP windows
Prerequisite for Win-KeX
The Visual C++ Redistributable packages are required to run Win-KeX, if not already installed, the packages can be downloaded here. Install the Universal C Runtime x86 (vc_redist.x86.exe) and x64 (vc_redist.x64.exe). Kali Linux requires Windows 10 version 2004 or later, and the Windows subsystem for Linux – WSL 2.
To use Win-KeX, a computer with Intel virtualization function VT-x is required. The BIOS provides the operating system with the virtualization function, for which you activate the Intel (R) Virtualization Technology in the UEFI BIOS settings.
Linux Shell in Windows Terminal
Also now is a good time to mention the Windows Terminal, if not already installed, it is worth doing it now.
Windows Terminal can be installed from the Windows Store.
Windows Terminal is a multi-tabbed command-line frontend for Windows 10. The shell of Kali Linux – ZSH can be used with Windows Terminal.
Kali Linux Sources Link kali.org
Troubleshooting
If VcXsrv is trying to start Win-KeX in Seamless Mode, an error is issued by VcXsrv:
A fatal error has occurred and VcXsrv will now exit.
In the log, it’s the last lines in /tmp/win kexsl_user.log:
winMultiWindowXMsgProc - Fatal error 1 on xcb connection
winClipboardIOErrorHandler!
winClipboardProc - setjmp returned for IO Error Handler.
(II) Server terminated successfully (0). Closing log file.
here you can try to start Win-KeX with sudo:
sudo kex --sl --wtstart -s
A solution also brought the deletion of the logs under /tmp.
sudo rm -f /tmp/*.log
And stop the KeX server with the –stop and –kill option.
sudo kex --stop
sudo kex --kill
After that, the start of kex as a normal user became possible.
kex --sl --wtstart -s
Also, a Win-KeX reinstallation can fix the error:
sudo kex --stop
sudo kex --kill
sudo apt-get purge kali-win-kex
sudo apt-get install kali-win-kex
sudo apt-get install dbus-x11
The Win-KeX help can also be useful.
kex --help
Win-Kex 2.10 provides a GUI desktop experience for Kali Linux
in Windows Subsystem for Linux 2 (WSL 2)
Usage:
kex <mode> <command> <parameters>
Mode:
--esm : Launch KeX desktop in a dedicated window using Windows native RDP
--sl : Seemlessly integrate KeX into the Windows desktop
--win : Launch KeX desktop in a dedicated window
Command:
[none] : start KeX server and launch KeX client
--start : start kex server
--start-client : start kex client
--stop : stop kex server
--status : show kex server status
--kill : stop kex server and kill all related processes
--passwd : set kex server password
--wtstart : start kex server and launch win-kex client
in Windows Terminal session
--start-sound : start Windows sound server
--stop-sound : stop Windows sound server
--help : display help
--version : display version
Parameters:
-i : Use container IP address instead of "localhost"
-m : Optimized for Multiscreen (Win mode only)
-s : Sound support
Examples:
kex -s : Start KeX server in window mode and launch KeX client with sound support
kex --sl -s : Start KeX in seemless mode and launch KeX client with sound support
kex --esm -i -s : Start KeX in ESM mode with arm workaround and launch KeX client with sound support
sudo kex : Start KeX server as root in window mode and launch KeX client
WSL2 is a great option if you don’t want to completely setup your Linux machine and just want to use Linux on Windows without having to deal with dual-booting or virtual machines.
No matter if you are a security professional or are pursuing cybersecurity, you have probably heard about WSL2, which is commonly used as an alternative to VirtualBox & VMware.
But if you’re not sure how to get started with WSL2, then you are at the right place, where I will show you how to install the Windows Subsystem for Linux (WSL2) on Windows 10 with Kali Linux.
So let’s roll up our sleeves and get started with the first task of installing WSL on your Windows, and then we will show you how you can install Kali Linux on Windows 10 and 11.
Before jumping to the installation part, first understand What is the WSL? In layman’s terms, a WSL, or Window Subsystem Linux, allows users to use GNU/Linux distributions alongside Windows as their default system.
At present, WSL has two versions: WSL1 and WSL2, but it’s good to have the latest version of WSL on your Windows machine.
And here is the comparison between WSL1 and WSL2, in that you can clearly see that WSL2 is a significant improvement over WSL1 in terms of performance, compatibility, and functionality.
Not only that, after installing wsl2, you can access most of the Linux command-line tools like awk
, sed
, grep
, and many other utilities directly on Windows without switching to Dual-Boot or using virtualization technology like VMware or VirtualBox.
Benefits of Using WSL2
- No need to use VirtualBox
- Download the GNU/Linux Distribution directly from Microsoft Store.
- Run the native Linux command-line utilities
awk
,sed
,grep
, and thevi
command line editor on Windows. - Use both Windows and Linux in parallel
There are many other advantages to using WSL2, but there are some minor limitations, too, like the fact that I/O file transfer is slow compared to native environment.
Install WSL2 on Windows 10
Now the fun part begins, where you learn how to install WSL2 on Windows 10 by two different methods, one of which is as simple as running one command and WSL is ready for use, and another one is quite intensive.
I would recommend you to go with the first method, if it’s not working for you then move the second.
- Install WSL2 on latest build of Windows 10/11
- Install WSL2 on older build of Windows 10
Install WSL2 on latest build of Windows 10/11
One of the easiest ways to install WSL2 on the latest build of Windows 10/11 is by running one line of command, which will install the WSL.
But for that, you need to be on the latest build, and to verify, run the following command on your system command prompt or PowerShell:
winver
Once you run the above command, it will show the system build version. If the build version is 2004 or higher, then you can follow this method, and if not, then read these steps.
The output of the above confirmed that my system is eligible for installing WSL2 with the following method:
If your system build version is 2004 or higher, then run the next line of command into PowerShell or a command prompt with administrator privileges.
wsl --install
Once you have run the above command, it will make the necessary changes and install the Ubuntu distribution on it.
After completion of the above step, click here to install Kali Linux on Windows 10 or 11.
Install WSL2 on older build of Windows 10
Due to some reason, if you are not on the latest build of Windows 10, then you can follow this method to install WSL2 on your computer by first checking the minimum version that should be available (like 1903 or later, with Build 18362 or later) to install
Step 1: Check the Latest Version of Windows
If you are unsure which version of Windows 10 you are using, type the following command on the “command prompt” or in the “Run” box.
In case your window version does not match the requirement, then update the window version.
To update Windows to the latest version Press the Start or Window key + I to launch the settings menu, click on Update and Security, then click on Check for updates.
or directly click this link to open Windows Update Settings and click on Check for updates.
Download the update for your system, and then restart your computer to make sure the update is fully installed.
If you are not able to see the latest window version despite the old version, then my advice is that you should restart your PC or check the service status of “Window Update Service” from the Services.
Step 2: Enable WSL2 on Windows
After completing the above step, you now have to enable WSL2 in your system.
To enable WSL2, press the Windows Start key and search for Powershell, click on Run as Administrator, and when it prompt click on allow.
or else you can use the shortcut Window Key + X and open Command Prompt as administrator .
To enable WSL2, type or copy-paste the following command on Windows PowerShell:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
It’s not necessary to restart your system; then also restart your system to avoid any package clashes.
Step 3: Set WSL version to WSL2
After restarting your system, open PowerShell as administrator and pass the following command to set the WSL to version WSL2.
wsl --set-default-version 2
That’s it, your work is done; now you will see how to install Kali Linux on your Windows computer.
Install and Run Kali Linux on WSL2
We were able to enable WSL2 on the Windows system, and now we will install Kali Linux on WSL.
To install Open Microsoft Store, press the Start Key and search for “Microsoft Store” or simply click the below button to open the store.
On the right side corner, you will able to see the search bar. Type “Kali Linux” and download the file.
The file size is approximately 276 MB, and it will take some time to download on your system as per your internet speed.
Run Kali Linux
When the download is finished, click on Launch or press the window key and search for Kali Linux.
Initially, it will ask you to set a “username” andpassword,” so please enter the username, password, and confirm password.
Now you will able to use Kali Linux on WSL.
Troubleshooting
If you are not able to install Kali Linux from the Microsoft Store and you’re getting the error “0x80073D05” like below the screen:
To resolve this issue, it is advisable to restart your device and try again to reinstall Kali Linux.
If you are not able to install Kali Linux and getting the WslRegisterDistribution failed with error 0x8007019e.
To resolve this issue Open the Run box and type appwiz.cpl
. On the left side of the screen, you will find the option “Turn Windows features on or off,” so please click on that.
Now scroll down below and you will see the Windows Subsystem for Linux, so please check that option and wait for a few seconds to apply the settings.
Next, restart your system and run Kali Linux from the start menu.
There is another kind of error that causes WSL 2 to won’t run Ubuntu and throw the error 0x80370102. If you are getting this error, then you need to run the following command to enable Hypervisor:
bcdedit /set hypervisorlaunchtype auto
If you are facing any other issue, then check this guide for complete troubleshooting steps for WSL.
Wrap up
That’s all for this article, where you learned how to install WSL on Windows 10 and 11 with Kali Linux, but I have not included the steps to enable the GUI interface here.
If you want to learn how to install or enable a GUI for Kali-Linux using Win-Kex, then click here.
And with that message, let me end this article here.