Things you need:
First, you need to have Windows 10 system then according to Microsoft’s instructions to enable and install WSL and Python 3.0.
Once you’re sure you’re using the correct version of Windows 10 Anniversary Update, open the Settings app and head to Update & Security > For Developers. Activate the “Developer Mode” switch here to enable Developer Mode.
Next, open the Control Panel, click “Programs,” and click “Turn Windows Features On or Off” under Programs and Features. Enable the “Windows Subsystem for Linux (Beta)” option in the list here and click “OK.”
After you do, you’ll be prompted to reboot your computer. Click “Restart Now” to reboot your computer and Windows 10 will install the new feature.
1. Update your Windows 10 machine. Open an administrative PowerShell window and install the Windows Subsystem with this one-liner. A reboot will be required once finished.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
After your computer restarts, click the Start button (or press the Windows key), type “bash”, and press “Enter.”
The first time you run the bash.exe file, you’ll be prompted to accept the terms of service. The command will then download the “Bash on Ubuntu on Windows” application from the Windows Store. You’ll be asked to create a user account and password for use in the Bash environment.
If you’d like to automate the installation of Bash instead, you can run the following command in a Command Prompt window. This will automatically agree to all prompts and set the default user to “root” with no password:
lxrun /install /y
How to Use Ubuntu’s Bash Shell and Install Linux Software
You’ll now have a full command-line bash shell based on Ubuntu. Because they’re the same binaries, you can use Ubuntu’s apt-get command to install software from Ubuntu’s repositories. You’ll have access to all the Linux command line software out there, although not every application may work perfectly–especially in the initial beta releases.
To open the Bash shell, just open your Start menu and search for “bash” or “Ubuntu.” You’ll see a “Bash on Ubuntu on Windows” application. You can pin this application shortcut to your Start menu, taskbar, or desktop for easier access.
If you’re experienced using a Bash shell on Linux, Mac OS X, or other platforms, you’ll be right at home. You don’t need to use sudo, as you’re given a root shell. The “root” user on UNIX platforms has full system access, like the “Administrator” user on Windows. Your Windows file system is located at /mnt/c in the Bash shell environment.
Use the same Linux terminal commands you’d use to get around. If you’re used to the standard Windows Command Prompt with its DOS commands, here are a few basic commands on both Bash and Windows:
- Change Directory: cd in Bash, cd or chdir in DOS
- List Contents of Directory: ls in Bash, dir in DOS
- Move or Rename a File: mv in Bash, move and rename in DOS
- Copy a File: cp in Bash, copy in DOS
- Delete a File: rm in Bash, del or erase in DOS
- Create a Directory: mkdir in Bash, mkdir in DOS
- Use a Text Editor: vi or nano in Bash, edit in DOS
It’s important to remember that, unlike Windows, the Bash shell and its Linux-imitating environment are case-sensitive. In other words, “File.txt” with a capital letter is different from “file.txt” without a capital.
For more instructions, consult our beginner’s guide to the Linux command-line and other similar introductions to the Bash shell, Ubuntu command line, and Linux terminal online.
You’ll need to use the apt-get command to install and update the Ubuntu environment’s software. Be sure to prefix these commands with “sudo”, which makes them run as root–the Linux equivalent of Administrator. Here are the apt-get commands you’ll need to know:
- Download Updated Information About Available Packages: sudo apt-get update
- Install an Application Package: sudo apt-get install packagename (Replace “packagename” with the package’s name.)
- Uninstall an Application Package: sudo apt-get remove packagename (Replace “packagename” with the package’s name.)
- Search for Available Packages: sudo apt-cache search word (Replace “word” with a word you want to search package names and descriptions for.)
- Download and Install the Latest Versions of Your Installed Packages: sudo apt-get upgrade
Once you’ve downloaded and installed an application, you can type its name at the prompt and press Enter to run it. Check that particular application’s documentation for more details.
How to Change Your Default User Account for Bash
To change your default user account in the Ubuntu Bash shell, open a Command Prompt window or PowerShell window. Right-click the “Start” button or press Windows+X on your keyboard and select “Command Prompt” to open one.
In the Command Prompt window (not a Bash shell window), run the following command. Replace “myusername” in the below command with your new username:
lxrun /setdefaultuser myusername
Here is the real work
git clone https://github.com/RoliSoft/WSL-Distribution-Switcher.git cd WSL-Distribution-Switcher python get-prebuilt.py kalilinux/kali-linux-docker python install.py rootfs_kalilinux_kali-linux-docker_latest.tar.gz
If the user account doesn’t already exist in the Bash environment, it will be created and you’ll be prompted for your password.
If you’d like to use the root account as your default user account, you can run the below command:
lxrun /setdefaultuser root
This will set the root user account as your default user account without a password.
Run Graphical Linux Desktop Applications from Windows 10’s Bash Shell
The installation process is simple: You can just accept the default settings. It will then automatically launch and run in your system tray, waiting for you to run graphical programs.
Install the Program
GTK-based vim editor. You’d run the following command in the Bash window:
sudo apt-get install vim-gtk
Set Your Display Environment Variable
Now, you’ll need to set the “DISPLAY” environment variable to point at the X server running on your Windows 10 PC. If you don’t do this, graphical applications will simply fail to launch.
To do this, run the following command in the Bash environment:
Launch an Application
You can now just launch a graphical application by typing the name of its executable, like you’d type any other command. For example, to launch vim-gtk, you’d run:
For windows creator update 1709
lxrun /install /y git clone https://github.com/RoliSoft/WSL-Distribution-Switcher.git cd "WSL-Distribution-Switcher" python get-prebuilt.py kalilinux/kali-rolling python install.py rootfs_kalilinux_kali-rolling_latest.tar.gz lxrun /setdefaultuser root bash bash -c "export DISPLAY=:0"
tutorial by D4RkNiK0l4s!