Running Ubuntu / Kali in Windows Subsystem for Linux
The Windows Subsystem for Linux (WSL) lets developers install a Linux distribution (such as Ubuntu, OpenSUSE, Kali, Debian, Arch Linux, etc) and use Linux applications, utilities, and Bash command-line tools directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.
Related Post:
Pre-requisites
Install WSL
You can now install everything you need to run WSL with a single command. Open PowerShell or Windows Command Prompt in administrator mode by right-clicking and selecting "Run as administrator", enter the wsl --install command, then restart your machine.
wsl --install
This command will enable the features necessary to run WSL and install the Ubuntu distribution of Linux. (This default distribution can be changed).
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: kali New password: Retype new password: passwd: password updated successfully Installation successful! ┏━(Message from Kali developers) ┃ ┃ This is a minimal installation of Kali Linux, you likely ┃ want to install supplementary tools. Learn how: ┃ ⇒ https://www.kali.org/docs/troubleshooting/common-minimum-setup/ ┃ ┗━(Run: “touch ~/.hushlogin” to hide this message) ┌──(kali㉿ECOR-ITLT-17)-[~] └─$ ┌──(kali㉿ECOR-ITLT-17)-[~] └─$ ┌──(kali㉿ECOR-ITLT-17)-[~] └─$
Set up your Linux user info
Once you have installed WSL, you will need to create a user account and password for your newly installed Linux distribution.
Ubuntu
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows Loading personal and system profiles took 1148ms. PS C:/Users/netsec> wsl --install Ubuntu is already installed. Launching Ubuntu... To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. PS C:/Users/netsec> wsl -l -o The following is a list of valid distributions that can be installed. Install using 'wsl.exe --install <Distro>'. NAME FRIENDLY NAME Ubuntu Ubuntu Debian Debian GNU/Linux kali-linux Kali Linux Rolling Ubuntu-18.04 Ubuntu 18.04 LTS Ubuntu-20.04 Ubuntu 20.04 LTS Ubuntu-22.04 Ubuntu 22.04 LTS Ubuntu-24.04 Ubuntu 24.04 LTS OracleLinux_7_9 Oracle Linux 7.9 OracleLinux_8_7 Oracle Linux 8.7 OracleLinux_9_1 Oracle Linux 9.1 openSUSE-Leap-15.6 openSUSE Leap 15.6 SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5 SUSE-Linux-Enterprise-15-SP6 SUSE Linux Enterprise 15 SP6 openSUSE-Tumbleweed openSUSE Tumbleweed
Set up your Linux user info
Once you have installed WSL, you will need to create a user account and password for your newly installed Linux distribution.
WSL Commands
wsl -l -v
in PowerShell or Windows Command Prompt.PS C:/Users/netsec> wsl -l -v NAME STATE VERSION * Ubuntu Running 2 kali-linux Stopped 2
WSL supports running as many different Linux distributions as you would like to install. This can include choosing distributions from the Microsoft Store, importing a custom distribution, or building your own custom distribution.
There are several ways to run your Linux distributions once installed:
- Install Windows Terminal (Recommended) Using Windows Terminal supports as many command lines as you would like to install and enables you to open them in multiple tabs or window panes and quickly switch between multiple Linux distributions or other command lines (PowerShell, Command Prompt, Azure CLI, etc). You can fully customize your terminal with unique color schemes, font styles, sizes, background images, and custom keyboard shortcuts. Learn more.
- You can directly open your Linux distribution by visiting the Windows Start menu and typing the name of your installed distributions. For example: "Ubuntu". This will open Ubuntu in its own console window.
- From Windows Command Prompt or PowerShell, you can enter the name of your installed distribution. For example:
ubuntu
- From Windows Command Prompt or PowerShell, you can open your default Linux distribution inside your current command line, by entering:
wsl.exe
. - From Windows Command Prompt or PowerShell, you can use your default Linux distribution inside your current command line, without entering a new one, by entering:
wsl [command]
. Replacing[command]
with a WSL command, such as:wsl -l -v
to list installed distributions orwsl pwd
to see where the current directory path is mounted in wsl. From PowerShell, the commandget-date
will provide the date from the Windows file system andwsl date
will provide the date from the Linux file system.
References
版权声明:
作者:congcong
链接:https://www.techfm.club/p/183791.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论