About Kali Install Options
There are many ways to run Kali Linux including live CD, virtual appliance, ISO, and now via the Microsoft App Store on Windows 10. The app is free and allows you to jump right into the distro.
For the purposes of this write-up, we will cover the usage of Kali Linux App from the Micosoft App Store. Not in-scope is the Kali Installed deployment choice, which is when you install Kali from ISO or OVA, for example.
What is Kali Linux?
Kali Linux is a security distro based on Debian and is used by InfoSec folks to keep us safe. None of the apps/tools are installed by default in the App version; You may like it for that reason. Also, nothing starts automatically which is nice.
First, We will install the Kali Linux App and PowerShell Core. Finally, we install the optional packages InfluxDB and Grafana. These last two packages are great for collecting and visualizing datapoints. I use it for performance metrics but you can visualize anything (i.e. interesting traces, open ports, etc.).
Currently, direct networking from the app is blocked by design. This means that you cannot reach devices on your network. However, you can web surf, update, download, etc.
If you need to access devices on your network from Kali Linux, then use Kali Installed (i.e. built from ISO or OVA) instead of Kali App. Another option is Ubuntu App, which is allowed to use all direct networking.
Step 1. Enable the Windows Subsystem for Linux (WSL) feature.
We could do this from Windows Features (GUI) but of course we prefer to run PowerShell as Administrator and perform the following:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Step 2. Reboot
Step 3. Install Kali Linux App
Here we will install Kali Linux from the Microsoft App Store.
- Left-click the Windows Start button
- Scroll to the Microsoft Store icon and click it
- The App Store appears
- Optional - Click the App Tab
- Click search and enter linux
- Locate the selection for WSL and click it
- Observe the selections such as Ubuntu, Suse, etc. and have a look around
- When ready, click on Kali Linux as your choice
- Follow the prompts to save the shortcut as desired
- Observe a new icon is available in your Start Menu (if chosen)
- Right-click the icon and add to your Taskbar
- Launch Kali by Left-clicking the icon (i.e. from your Taskbar or Start Menu)
Note: There is no need to
Run As Administrator since
WSL is designed to run properly without elevation. However, you can run elevated if desired.
Step 4. New User Setup (required for Kali App)
Upon launching Kali App, we will be prompted to create a user. Enter a name and password.
Step 5. Basic configuration complete
We are done with the initial install. Save a shortcut to the app if you have not already. Next we will update and then start adding packages.
Update Kali Linux
Next, we will update the bits in our Kali App. If we break anything, we can do an instant restore of the App to default.
sudo apt-get update sudo apt-get dist-upgrade
Optional - List your version
This lets us know we are working with Kali. The output looks the same for both Kali App and Kali Installed.
Get the desktop environment
Here we will install
xrdp which lets you use standard Windows RDP to a Linux device.
wget https://kali.sh/xfce4.sh cat ./xfce4.sh sudo sh xfce4.sh sudo /etc/init.d/xrdp start
RDP Session to Kali
xrdp the default port is 3390. We can connect to Kali with mstsc as shown below.
From Start > Run, enter the following:
Preparing Kali for PowerShell
Paste in one line at a time to the Kali terminal.
sudo apt update sudo apt -y install curl gnupg apt-transport-https sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - sudo touch /etc/apt/sources.list.d/powershell.list sudo nano /etc/apt/sources.list.d/powershell.list
While in nano, add the following line:
deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main
Tip: To save with nano, press
CTRL + X, then
Install dependency for PowerShell Core (undocumented)
sudo apt -y install libcurl3
sudo apt -y install powershell
Launch PowerShell like this in Kali (at least until PowerShell Core preview 3):
This seems to be fixed on PowerShell 6.0.1 Core preview 3 https://vmkdaily.ghost.io/launching-powershell-6-0-1-preview-3-on-linux-and-macos-the-new-way/
Create PowerShell $PROFILE
Test-Path $PROFILE returns false, you can create one as shown below.
New-Item -ItemType File -Path $PROFILE -Force
Here we add a line to our $PROFILE that stops the beeping sound that PowerShell makes.
Add-Content -Value "Set-PSReadlineOption -BellStyle None" -Path $Profile
Reload your PowerShell $PROFILE, or exit
There is a shortcut to reload the PowerShell $PROFILE:
However, it is preferred to just exit PowerShell and relaunch:
Note: You can use PowerShell the same way from Windows 10 Kali App Terminal, or from an xrdp session and working within the Kali desktop environment.
Visual Studio Code (VSCode) is the universal goto editor for PowerShell scripts. It supports tons of operating systems and script types. Let's get this on there so we can be elegant.
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' sudo apt-get update sudo apt-get install code
If you only need working PowerShell and a good script editor, you are done!
Stick around to learn about collecting and visualizing data points with the open source packages InfluxDB and Grafana.
Let's start our visualization journey by downloading Grafana.
Optionally, check for more recent versions at https://packagecloud.io/grafana/stable/
Update the libfontconfig1 and adduser packages if needed.
Let's add some required packages.
sudo apt-get install -y libfontconfig1 adduser
Note: Other linux distros may use libfontconfig but since we use libfontconfig1 on Kali, the native Grafana instructions are slightly modified for our purposes here.
Install Grafana 5.1.3
Finally, the actual Grafana install.
sudo dpkg -i grafana_5.1.3_amd64.deb
Start Grafana 5.1.3
By default, Kali Linux App does not autostart apps by design. As such, we will always start Grafana manually when needed.
sudo /bin/systemctl start grafana-server
This is a good time to take the Firefox browser for a spin if you have not already. Locate the icon on your desktop and navigate to localhost with a port of 3000 like so:
Next we create the InfluxDB database. Leter we will come back and point Grafana to the database.
Download InfluxDB 1.5.3 for Linux
InfluxDB is a time series database. It is great for collecting realtime events, stats, and nearly anything. Let's install now, and explain on the way.
Note: To check for updated versions of InfluxDB see:
Install InfluxDB 1.5.3
Now that we have downloaded the package, let's go ahead and install it:
sudo dpkg -i influxdb_1.5.3_amd64.deb
Confirm influx binaries exist
which influx which influxd
Add permissions for your user (whoami)
Adjust for your username below and set permissions, if desired.
sudo chown -R mike /var/lib/influxdb
sudo service influxdb start
Get datapoints into InfluxDB
Use the official InfluxDB site to learn about gathering datapoints:
Point Grafana to InfluxDB
Use the official Grafana documentation to lean about pointing to an InfluxDB datasource:
APPENDIX - How to remove the apps completely from Kali Linux:
sudo apt-get remove --purge influxdb sudo apt-get remove --purge grafana-server sudo apt-get remove --purge xrdp