Installing Kali Linux next to Windows 10. Installing Kali as an additional operating system on a Windows computer. Step-by-step instructions for installing Kali Linux on a computer

We are always on the lookout for new environments to run Kali and with the introduction

Hidden from guests

For Linux (WSL) in Windows 10, there are new and exciting features. After all, if WSL can support Ubuntu, it shouldn't be too hard to include another Debian-like distribution, right? This is especially true with the utility

Hidden from guests

Hidden from guests

.

Kali on...Windows? Actually?

While installing Kali on Windows is not optimal due to various environmental restrictions (such as lack of sockets and individual Kali kernels), there are still many situations where Kali Linux along with your Windows 10 machine can be useful. One example that comes to mind is workspace consolidation, especially if your primary work environment is Windows. Other useful situations are the standardization of tools and scripts that cross our minds to run in multiple environments, the quick porting of Linux penetration testing utilities to the Windows command line, and so on. For example, below is a screenshot of running the Metasploit Framework from Kali Linux in WSL.

Environment setup

While the installation is described in more detail in

Hidden from guests

WSL file distribution switcher, we made a quick 4 minute video that walks you through the installation process. For simplicity, copy/paste operations of these basic steps:

1. Upgrade your Windows 10 machine. Open an administration PowerShell window and install the Windows subsystem with this one-liner. Reboot required after completion.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

2. After the reboot, open a command prompt shell and run the following commands to install the default Ubuntu environment. This will lay the foundations for our Kali setup.

lxrun /install

3. Install and locate the WSL switch, download the Kali base and extract it to disk:

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 lxrun /setdefaultuser root

4. Kali is now installed on your Windows 10 machine and you can interact with it by running the "bash" command:

5. You are now inside Kali and you can use it as you normally would - install packages, use tools, etc. We strongly recommend that you run the updates first:

Export LANG=C apt-get update apt-get dist-upgrade

Without further ado, here is a video demonstration of the setup described above:

Good news for penetration testers and possibly hackers as Kali Linux is now available in the Windows Store.

Previously, systems such as:, SUSE, and Arch Linux have already been added. And now Kali is joining them.

Over the past few weeks, developers have been working with the Microsoft WSL team to add Kali Linux to the Microsoft App Store as an official WSL distribution, and finally today, the availability of the Windows app "Kali Linux" was announced. For Windows 10 users, this means you can simply enable WSL, search for Kali in the Windows store, and install it with one click. This is especially exciting news for security and penetration testing professionals who have limited tools due to corporate compliance standards.

Even though Kali on Windows has a few downsides to running it (e.g. no raw-socket support), it does lead to some very interesting features, and you'll have access to a security toolkit extension, and full set command line tools that are present in Kali.

How to Install Kali Linux on WSL

A brief description of the installation process will be provided here.

1. You must update your Windows 10 to latest version. Next, open PowerShell and install the subsystem using the command below. A reboot will be required upon completion.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

2. After the reboot, open the Windows Store and search for the "Kali Linux" app. Install the app and enjoy Kali!

In this video you will see how to do it

How to update Kali Linux in WSL

Updating Kali Linux in WSL is no different than any other Kali instance

You should just enter the commands

apt-get update apt-get dist-upgrade

Installing Penetration Testing Tools in Kali

Installing tools from the Kali Linux repository is usually done using apt commands. For example, to install the Metasploit Framework, you just need to enter the commands

apt-get update apt-get install metasploit-framework

Note. Some Kali tools are identified as malware by antivirus software. One way to deal with this situation is to allow antivirus exceptions in the directory where the Kali chroot is located. The following video shows how to do it.

Recovery Kali WSL

Sometimes you can inadvertently kill your Kali WSL instance due to a wrong command, an unintended action, or even Kali or WSL bugs. If this happens, you can restore the system to default. Note: This process will destroy your Kali WSL chroot and re-extract a new copy. Any changes made to the file system will disappear and be reset to the default value.

Conclusion

The availability of the Kali Linux platform and toolset in Windows 10 brings with it many exciting possibilities. While not officially supported by WSL, the developers have tested running the XFCE desktop and it seems to work well.

Users now get an environment for testing Linux applications right inside Windows, which is faster than in a virtual machine.

What you need to know about the Bash shell in Windows 10

The WSL feature is not really a Linux virtual machine, container, or software compiled for Windows. Windows 10 offers a complete Windows 10 subsystem designed to run Linux software. The subsystem is based on the Microsoft Astoria project, which was originally intended to run android applications on Windows.

WSL can be seen as the opposite of Wine. While Wine allows you to run Windows applications directly on Linux, the Windows Subsystem for Linux allows you to run Linux applications directly on Windows.

When creating a shell environment based on Bash Ubuntu, Microsoft worked in conjunction with Canonical. The shell runs on top of the subsystem and is technically not Linux. Linux is the main kernel of the operating system, which is not available in the subsystem. Instead, the WSL feature allows you to run a Bash shell and execute the same binaries that run on Ubuntu Linux. Many open source advocates believe that the Linux operating system is properly called “GNU/Linux” because a lot of GNU software runs on the Linux kernel. The Bash shell that you get with Windows 10 contains GNU utilities and other software.

Although this feature was originally called "Ubuntu Bash on Windows", it also allows you to run Zsh and other command line shells. Other Linux distributions are now supported. You can choose openSUSE Leap or SUSE Enterprise Server over Ubuntu, Fedora support coming soon.

There are some limitations when using the shell. By default, background server software and Linux graphical applications are not supported. Also, not all command line applications work in this environment because the feature is not perfect.

How to Install Bash on Windows 10

This feature does not work on the 32-bit version of Windows 10, so make sure you are using the 64-bit version.

If you are using a 64-bit version of Windows, then go to Control Panel > Programs and Features > Turn Windows features on or off. Check the box and click OK.

Then click "Restart Now" to restart your computer and apply the changes. The function will not work until reboot.

Note A: Starting with Windows 10 (version 1709), you no longer need to turn on Developer Mode in the Settings app to use this feature. You just need to enable the subsystem in the Windows Components window.

Once your PC restarts, open the Microsoft Store and search for “Linux”. A list of applications available for installation will open.

Note A: Starting with Windows 10 (version 1709), you will no longer be able to install Ubuntu by running the bash command. Instead, you need to install Ubuntu or another Linux distribution from the Microsoft Store.

So, you will see a list of all Linux distributions available in the Microsoft Store. Starting with Windows 10 (version 1709), the store offers Ubuntu, openSUSE Leap, openSUSE Enterprise, Debian Linux, Arch Linux, and Kali Linux.

To install a specific distribution, select it and click the "Get" or "Install" button. As a result, the usual installation will start, as is the case with other applications from the Microsoft Store.

If you don't know which Linux environment to install, we recommend Ubuntu. This popular Linux distribution was previously the only option available, but other Linux systems are now available for different user needs.

You can also install multiple Linux distributions and each one will get its own unique labels. You can even run multiple different Linux distributions at the same time on different windows.

How to Use the Bash Shell and Install Linux Software

After a successful installation, you get a full Bash shell based on Ubuntu or another Linux distribution of your choice.

Since Linux systems use the same binaries, you can use Ubuntu commands apt or apt-get to install software from the Ubuntu repository. Just use whatever command you normally use on that Linux distribution. You will have access to all Linux command line software there, although some applications may not work perfectly.

To open your installed Linux environment, simply open the start menu and search for any distribution you have installed. For example, if you installed Ubuntu, launch the Ubuntu shortcut.

You can pin the app tile to the Start menu, taskbar, or place a shortcut on your desktop for quick access.

The first time you start the Linux environment, you will be prompted for a UNIX username and password. They do not need to match your Windows username and password, and will be used in a Linux environment.

For example, if you enter “comss” and “qwerty” as your credentials, your username in a Linux environment will be “comss” and the password you use in a Linux environment will be “qwerty”, regardless of the username and password Windows.

You can start the installed Linux environment with the command wsl. If you have multiple Linux distributions installed, you can select the default Linux environment that this command will launch.

If you have Ubuntu installed, you can also run the command to launch it. For OpenSUSE Leap 42 use opensuse-42. For SUSE Linux Enterprise Server 12 use sles-12. These commands are listed on each Linux distribution's page in the Microsoft Store.

Alternatively, you can start a standard Linux environment by running the command bash, but Microsoft says this method is deprecated. This means that the bash command may stop functioning in the future.

If you have experience using the Bash shell on Linux, MacOS, or other platforms, you will feel confident.

On Ubuntu you need to use the command prefix sudo to run them as root. The "root" user on UNIX platforms has full access to the system, similar to the “Administrator” in Windows. The Windows file system is located along the path to /mnt/c in the Bash shell environment.

With WSL, you can use familiar Linux terminal commands. If you're used to the standard Windows command line with its DOS commands, here are a few basic commands common to Bash and Windows:

  • Change directory: cd in bash, cd or chdir in DOS
  • Show directory contents: ls in bash, dir in DOS
  • Move or rename file: mv in bash, move and rename in DOS
  • Copy file: cp and bash, copy in DOS
  • Delete a file: rm in bash, del or erase in DOS
  • Create directory: mkdir in Bash, mkdir in DOS
  • Use text editor: vi or nano in bash, edit in DOS

It is important to remember that, unlike Windows, the Bash shell and the Linux environment that mimics it are case sensitive. In other words, the file named “File.txt” is different from the file named “file.txt”.

To install and update the software of the Ubuntu environment, you will need to use the command apt. Be sure to attach these commands to sudo, which makes them run as user root. Below are the basic apt-get commands you need to know:

  • Download updated information about available packages: sudo apt update
  • Install application package: sudo apt install packagename
  • Remove application package: sudo apt remove packagename(replace packagename with package name)
  • Search for available packages: sudo apt search word(replace word with a keyword in the package name or description)
  • Download and install latest versions installed packages: sudo apt upgrade

Once you have downloaded and installed the application, you can type its name into the shell and press Enter to run it.

Note: Software, which you set in the Bash shell, is limited to the Bash shell. You can access these programs from the command line, PowerShell, or elsewhere in Windows, but only if you run the command bash -c.

Optional: Install Ubuntu native font

If you want a more accurate Ubuntu experience on Windows 10, you can use the following instructions to install native Ubuntu fonts in the terminal.

To install the font, first download the Ubuntu font family from the Ubuntu website. Open the downloaded .zip file and find the file UbuntuMono-R.ttf. This is a fixed-width Ubuntu font that is only used in the terminal. This is the only font you need to install.

Double click the file UbuntuMono-R.ttf and you will see a preview of the font. Click "Install" to install the font on your system.

To make the Ubuntu monospaced font available in the console, you need to add a setting to the Windows registry.

Launch the registry editor using the Windows + R combination by typing regedit and pressing Enter.

Go to the following path:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont

Right-click in the right pane and select New > String Value. Name the new value 000. Double click on the string “000” you created and then enter as the value.

Then launch an Ubuntu window, right-click the title bar and select Properties. Go to the "Font" tab and select "Ubuntu Mono" in the font list.

Found a typo? Select and press Ctrl + Enter

Now many modern laptops do not have a DVD drive, so it is impossible to install the operating system from an optical disc. This is not a problem, since the installation can be done entirely from a USB drive, including a regular USB flash drive.

We need an operating system installation image (.iso file) and a flash drive, at least 4 GB in size.

Download Kali Linux from the official website: https://www.kali.org/downloads/

If you have difficulty which version to choose, then read about their difference.

Now you need to burn the image from Windows to a USB flash drive. It has to be done right - it's not enough to just copy the file. To get a flash drive suitable for installing the operating system, you need a program like. This is a free program - download and install it.

Connect your flash drive to your computer and launch Win32 Disk Imager.

Specify the image file (switch to view all files):

and correctly select Device (i.e. flash drive):

When you're done, click the button Write. Remember that all data from the flash drive will be deleted!

How to boot from a flash drive Kali Linux

Disabling Secure Boot in BIOS

While the flash drive is being written, we need to turn off the Secure Boot option in BIOS.

Turn on your computer. If it does not have an operating system, then you will immediately enter the BIOS. If the operating system is already installed, press the button many times when booting the computer. Esc Delete) and select Enter Setup(may automatically enter BIOS):

Click F7 to go to Advance Mode and there select the tab security. Find an option secure boot:

Disable it (choose disabled):

To save the settings, press F10.

Look for an option fast boot- if you have it, also disable it ( disabled).

Booting from a flash drive Kali Linux

When writing to the USB flash drive is over, insert the USB flash drive into the laptop slot and turn it on - if the inscription " Please press any key to boot from CD or DVD”, then press any button. This inscription translates to “please press any button to boot from CD or DVD. Despite the fact that we are booting from a USB flash drive, this suits us.

If the operating system is already installed, press the button many times when booting the computer. Esc(on some computers you need to press Delete). If the download options appear, then select the item that matches your flash drive.

If such a menu does not appear, then go to BIOS and select a USB flash drive as a boot disk.

Step-by-step instructions for installing Kali Linux on a computer

In this window select Start Installer:

Choose language:

Choose Yes:

Choose according to your preference:

A message about the need for a driver for a Wi-Fi card, I don’t have this driver, so I skip it. You may not see a message like this at all:

I continue as is:

I'm skipping the network setup:

Enter hostname:

Superuser password:

Timezone:

The most crucial moment is the selection and marking of disks. If you select the wrong drive, you may lose data (for example, remove another operating system):

As you can see, I already have another operating system installed.

If you want to remove the previous system and install Kali Linux instead, then erase the partitions from the old OS, create a new partition in the freed space and select it to install Kali.

If you have multiple disks, you can install Kali Linux on any idle one.

I will install Kali Linux directly on the main partition. To do this, I will change the size of the drive where Windows is installed,

and on the freed space I will create another partition, which I will install a new OS.

In addition to the main partition, it is proposed to install a swap partition (like a swap file on Windows). For these purposes, you can allocate a separate disk - depending on your needs, it can be 2-8 GB. The swap partition is used if the operating system does not have enough random access memory- data that is not currently used is reset to this partition. That is, it is, as it were, additional RAM, which is slower than the main one. I have 16 gigabytes of RAM so I don't create a swap partition.

Confirm the changes made:

We are waiting for the end of data copying:

If you have an Internet connection configured, you can choose to download packages from the network (more recent versions)

Wait until the system starts to reboot and remove the flash drive:

After installing Kali Linux, it will create its own GRUB bootloader. If you have other operating systems on your computer, this bootloader will find them all and put them in the boot menu for you to choose from.

Remember that the original Windows bootloader is not erased. That is, if you want Windows to boot by default, then go to BIOS and select the desired disk there, which should automatically boot.

Wrong GRUB display resolution

Usually the GRUB bootloader menu has the wrong display resolution. In the vast majority of cases, this is not a problem - the menu items are still visible, and quick-witted Linux immediately changes the resolution to the correct one as soon as it takes over control.

But not so with Windows. If you booted Windows using the GRUB bootloader with the wrong permission, then Windows will no longer be able to set the permission to the correct one in this session, even if you go to do it manually.

The easiest way to fix the situation is to change the GRUB screen resolution. First you need to find out what resolutions your computer supports. To do this, hold down the key while the download starts. Shift. When the GRUB boot menu appears, press the button c, and then in the console enter the command:

videoinfo

Take note of the highest display resolution that your video adapter supports.

Then boot into Linux. Open the file for editing /etc/default/grub.

Find the line in it

#GRUB_GFXMODE=640x480

Uncomment it (remove the hash at the very beginning) and replace 640x480 with the maximum resolution your computer supports. This is usually 1920x1080, so it should look something like

GRUB_GFXMODE=1920x1080

Save and close this file.

Update bootloader settings:

sudo update-grub

The next time you reboot, you will be able to enjoy the tiny letters in the upper left of the screen, but Windows will now have a normal resolution.

Now Kali Linux has appeared in the Microsoft Store. Powered by Windows Subsystem for Linux (WSL). If you are too lazy to follow the link, then WSL is such a Wine on the contrary, it allows you to run Linux applications natively (without a virtual computer) on Microsoft OS. Of the benefits - improved performance (compared to working in a virtual OS). And many different disadvantages: lack of support for raw sockets, hardware, partial support for the graphical interface, a number of kernel interfaces are not implemented, and so on.

I am not particularly close to the concept of WSL (in the form in which it is implemented now). Therefore, this note will be small: we will consider installing Kali Linux from the store Windows applications, run it, install a couple of applications, do a test run of them, install a graphical interface and connect to it. And why do you need to do all this through WSL - you already come up with it yourself.

How to Install Kali Linux on WSL

1. WSL is available on updated Windows 10. So update your Windows, open the window PowerShell(win+x) and run the command there

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

2. After the reboot, open the Microsoft Store and look for the application " Kali Linux". Or just click to go there right away. Install the app and enjoy Kali!

Click to install Get.

How to run Kali Linux on WSL

To "enjoy Kali" you need to at least run it. To do this, open PowerShell again and run the command

Initialization takes place at the first start - this takes some time.

We are then asked to create a default UNIX account. It may have nothing to do with your Windows user:

By default, the minimum number of packages is set. Therefore, you need to install the programs you need yourself.

The changed command line is your new Kali Linux.

Installing programs in Kali Linux on WSL

Everything is similar to the usual work in the console. Let's start with the system update:

sudo apt update sudo apt dist-upgrade sudo apt install wpscan whatweb

When installing some programs, for obvious reasons, there may be problems with the antivirus. You need to solve these problems on an individual basis (maybe add the entire Kali Linux folder - C:\Users\Alex\AppData\Local\Packages\KaliLinux.54290C8133FEE_ey8k8hqnwqnmg\ - to the antivirus exclusions).

How to run a program in Kali Linux on WSL

If you are used to the Kali Linux menu, then you will have to relearn how to run programs from the console. If you already run them in the console, then launching programs is no different:

For example, let's update the wpscan database

Sudo wpscan --update

Let's check some site on WordPress:

sudo wpscan -u spryt.ru

Let's collect some information about the site using what web:

whatweb suip.biz

How to restore Kali WSL

If you messed up the operating system (deleted files necessary for the OS to work, etc.), or just want to start with " clean slate”, then it is possible to reset the installation of Kali Linux in WSL to its original state.

Use Win+x to open " Applications and features”, find Kali Linux:

Click " Extra options", on the new page, click the button" Reset»:

The system will be removed and a new instance deployed. Accordingly, all changes made earlier will disappear.

Kali Linux GUI on WSL

Install XFCE:

Wget https://kali.sh/xfce4.sh sudo sh xfce4.sh

During the installation process, select the keyboard layout language and how to switch layouts (to navigate between elements, use the key TAB):

At the end, a message will appear that XRDP is configured to listen on port 3390, but the service itself is not running.

To start the service, run:

sudo /etc/init.d/xrdp start

On successful launch, you will see something like this:

[....] Starting Remote Desktop Protocol server: xrdp-sesman xrdp Testing if xrdp can listen on 0.0.0.0 port 3390. Closed socket 6 (AF_INET6::port 3390)

Now in Windows press Win+x and select " Run". In the window that opens, enter:

A new window will open, enter

127.0.0.1:3390

And press the button To plug».

A window will be displayed with a message:

Unable to authenticate the remote computer. Do you want to connect anyway?

This issue can occur if the remote computer is running a version of Windows earlier than Windows Vista, or if the server is not configured to support authentication.

Contact your network administrator or the owner of the remote computer for assistance.

Check the box " Don't ask me again about connections to this computer" and press " Yes».

A login window will appear, enter your Kali Linux username and password:

After signing in, you will be prompted, select " Use default config»:

Using a graphical desktop environment, you can run programs with a graphical interface (after they are installed).

To exit explicitly end the service, to do this, click on the username, click " logout…»:

Then uncheck the " Save session for future logins" and press " log out»:

Stop the service

sudo /etc/init.d/xrdp stop

Conclusion

Unfortunately, due to the implementation of the WSL architecture, some Kali Linux tools will not work. But those that do work (various site crawlers, brute forcers, network traffic capture file analyzers, and others) are quite convenient to use directly from the Windows command line, without having to run a whole virtual machine with Kali Linux, or reboot into a second system (if Kali is not your primary OS).

you already know about Faculty of Information Security from GeekBrains? Comprehensive annual program practical training covering all the main topics, as well as with additional courses For a present. Based on the results of the training, certificate standard pattern and certificate. Special discount for any faculties and courses!

Similar articles

2022 ganarts.ru. Greenhouse and garden. Arrangement. Growing. Diseases and pests. Seedling.