news

How to install Kali Linux and set it up for security testing

How to install Kali Linux 2026.3 in a virtual machine, on USB or with WSL2: verify the ISO, update, enable the firewall, pick tools and build a legal practice lab.

Kali Linux is a Debian-based Linux distribution maintained by OffSec, and it bundles hundreds of tools for penetration testing, meaning the authorized security assessment of a system by simulating an attack. It installs in a virtual machine, on a dedicated computer or from a USB stick. It needs hardening before the first test. The current version is 2026.3, released on October 26, 2026 with kernel 7.1.5 and KDE Plasma 6.7 (release notes).

For readers who want a Linux system they build and maintain by hand, our guide to installing Arch Linux with archinstall and updating it without breaking things runs from the ISO to weekly maintenance.

Security consultants and students use it, and so do people who compete in CTF events (Capture The Flag, contests where you break into systems built to be broken). The download is free from the official site and the project is open source. The distribution follows a rolling release model, so it updates continuously instead of shipping closed versions.

Installing Kali Linux, setting up the penetration testing environment
Kali Linux 2026.3, installation and initial setup
Try it now

Kali Linux images download for free from kali.org, no account needed. Builds exist for Intel/AMD (amd64) and ARM (arm64) processors, including ready-made images for VirtualBox, VMware, Hyper-V or QEMU.

What Kali Linux Contains

Kali Linux is a specialized distribution. Its value lies, in practice, in the repository, a curated catalog of programs for gathering information and hunting for vulnerabilities, plus others for cracking passwords and analyzing network traffic. There are also tools for writing the reports. Nmap, Burp Suite, Metasploit, sqlmap, Hashcat and John the Ripper are all there, ready to work together.

Kali, for its part, keeps network services off at boot and ships kernel patches for Wi-Fi packet injection. The repositories are kept to a bare minimum, because the project treats them as the only trusted source. Anyone who adds repositories from other distributions risks breaking the system. Ubuntu PPAs are not supported (official page on using Kali). That leaves one practical rule. Every outside tool gets installed separately, in its own directory, never through tricks with the package manager.

Anyone new to Linux should start from a general-purpose distribution and try Kali in a virtual machine, without making it the everyday system. The newest attack tools are in the official catalog. Release 2026.3 brought dalfox (an XSS scanner), katana (a web crawler), qsreplace, rustscan (a port scanner), sdrangel and snaffler-ng.

Which Installation Method Should You Pick?

The right method depends on what the hardware has to do. For a first lab, go with the virtual machine. It isolates Kali from the main computer, lets you roll back with a snapshot (a saved picture of the machine's state) and puts no disk at risk.

MethodWhen it fitsMain limitation
Prebuilt VM imageFirst lab, import it and goUser and password are kali/kali, change them right away
ISO installer in a VMYou choose user, partitions and disk encryptionA few extra minutes of installation
Dedicated computer (bare metal)Internal Wi-Fi and GPU for Hashcat at full powerThe installation wipes the chosen disk
Live USB with persistenceCarrying it to a client without installing anythingSlower, and persistence has to be set up by hand
WSL2 on WindowsCommand-line tools next to your daily workVirtualized network and hardware, no replacement for a VM
DockerA single tool in a throwaway containerNo graphical interface, data stays in the container

Downloading and Verifying the Image

An image downloaded from an unverified mirror is the most trivial way to install a system that is already compromised. Kali is an obvious target for anyone who wants to get into other people's labs. The official documentation proposes a two-step check, the GPG signature of the hash list and then the hash of the ISO (official procedure).

From the cdimage.kali.org/current folder you download the ISO (the current one is kali-linux-2026.3-installer-amd64.iso, or arm64 for Macs with an Apple chip) together with the SHA256SUMS and SHA256SUMS.gpg files, then you run this block.

verify-iso.sh bash
wget -q -O - https://archive.kali.org/archive-key.asc | gpg --import
gpg --fingerprint 827C8569F2518CC677FECA1AED65462EC8D5E4C5
gpg --verify SHA256SUMS.gpg SHA256SUMS
grep kali-linux-2026.3-installer-amd64.iso SHA256SUMS | shasum -a 256 -c

The fingerprint printed by the second command must be 827C 8569 F251 8CC6 77FE CA1A ED65 462E C8D5 E4C5, the RSA 4096 key that signs the Kali archives. The third command must report Good signature and the fourth kali-linux-2026.3-installer-amd64.iso: OK. On Linux you use sha256sum in place of shasum -a 256, and on Windows certutil -hashfile FILENAME sha256, comparing the result by eye against the list. If the check fails, throw the image away and download it again.

Installing in a Virtual Machine

The official site offers ready-made images for VMware, VirtualBox, Hyper-V or QEMU, compressed as 7z. You unpack them and import them into the hypervisor, and the machine boots with user and password kali. Anyone who prefers to pick the user, the language and the disk encryption uses the ISO installer and follows the guided procedure.

A reasonable starting point is 4 GB of RAM and 2 cores, with 40 GB of disk, rising to 80 GB if you install many tools or keep your scan output (these are common-sense values, not official requirements). For network scans the adapter should be set to bridged or host-only, depending on the lab you want to build. On a Mac with an Apple chip the arm64 image applies, with UTM or QEMU, both covered in the documentation.

If the window will not resize after the first boot and the clipboard does not pass between host and guest, the VirtualBox guest additions are missing.

guest-additions.sh bash
sudo apt update
sudo apt install -y virtualbox-guest-x11
sudo reboot

Once the machine is clean and up to date, take a snapshot and name it "base". The cleaner the base, the more reproducible the tests. If a VM ends up in a strange state, restoring it takes a minute instead of a reinstall.

USB Stick and Dedicated Computer

Writing the ISO to a USB stick erases everything on the stick, and installing to disk erases the chosen disk. Before any command, check with lsblk (Linux) or diskutil list (macOS) which device is the stick, because a wrong name means losing the data on your main computer. On Windows, Rufus in DD mode or balenaEtcher will do.

write-usb.sh bash
# Linux (replace sdX with the USB stick, for example sdb)
sudo dd if=kali-linux-2026.3-installer-amd64.iso of=/dev/sdX bs=4M status=progress conv=fsync

# macOS (rdiskN instead of diskN speeds up writing)
diskutil unmountDisk /dev/diskN
sudo dd if=kali-linux-2026.3-installer-amd64.iso of=/dev/rdiskN bs=4m

Installing on a dedicated computer makes sense when you need the internal Wi-Fi card in monitor mode or the GPU for Hashcat, two things a virtual machine handles poorly. Do it on a spare laptop, perhaps the one sitting in a drawer, never on the PC you use for daily work.

The live USB with persistence suits people who change workstations often (a client site, a test room). You write the live image instead of the installer, create a third ext4 partition in the leftover space with GParted and label it persistence, then boot from the "Live USB Persistence" entry.

persistence.sh bash
lsblk
sudo mkfs.ext4 -L persistence /dev/sdX3
sudo mkdir -p /mnt/usb
sudo mount /dev/sdX3 /mnt/usb
echo "/ union" | sudo tee /mnt/usb/persistence.conf
sudo umount /mnt/usb

Kali on Windows with WSL2 and Docker

WSL2 (Windows Subsystem for Linux, Microsoft's layer that runs Linux inside Windows) installs Kali with a single command from PowerShell. The graphical interface needs Win-KeX, the official remote desktop package.

wsl.ps1 powershell
wsl --install --distribution kali-linux
win-kex.sh bash
sudo apt update && sudo apt full-upgrade -y
sudo apt install -y kali-win-kex
kex --win -s

The weak point of WSL2 is the network, which goes through a virtual layer. Wi-Fi scans and sniffing, and VPNs too, need workarounds that a VM does not. It works well for practicing in the terminal and poorly for a real lab.

Docker serves a different purpose, running a single tool in a container that disappears at the end of the session. The official image is kalilinux/kali-rolling and it has to be completed with the headless metapackage.

docker.sh bash
docker run -it --rm kalilinux/kali-rolling
apt update && apt install -y kali-linux-headless

The --rm option deletes the container on exit, along with everything in it. To keep your output, mount a host folder with -v.

First Boot and Updates

The VM images, the live images and the ARM ones use user and password kali, while the installer asks you to create a standard user (default credentials). Anyone starting from a prebuilt image changes the password with passwd before doing anything else, especially if the VM is reachable from the local network.

The second step is the full update, which weighs a lot on a rolling distribution the first time around.

update.sh bash
sudo apt update && sudo apt full-upgrade -y
sudo apt autoremove -y
sudo reboot
# after the reboot
grep VERSION /etc/os-release

The expected result is VERSION_ID="2026.3". Since 2026.2 the repositories live in /etc/apt/sources.list.d/kali.sources (deb822 format), and on an older installation the command sudo apt modernize-sources converts the old sources.list (guide to the network repositories). The default branch is kali-rolling. Anyone who wants less frequent changes switches to kali-last-snapshot, which follows the quarterly releases.

snapshot.sh bash
sudo sed -i 's/^Suites: .*/Suites: kali-last-snapshot/' /etc/apt/sources.list.d/kali.sources
sudo apt update

Updating often is not a formality. Kali ships a recent Linux kernel. Kernel bugs are a daily matter (think of the 21-year-old flaw in the IPv6 firewall or NFS2ROOT, which hands root on an NFS server to anyone without a password). An attack machine with an outdated kernel is the first one to get breached.

Hardening the Machine

Kali ships with network services switched off by design, so the hardening is short. You check what is listening on the network and turn on a firewall.

hardening.sh bash
sudo ss -tulpn
systemctl list-unit-files --state=enabled

sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable

One detail that trips up beginners is that with deny incoming even the listeners you open on purpose (a Metasploit handler on a high port, a test HTTP server) stay blocked. When needed you open one port at a time with sudo ufw allow 4444/tcp and close it again at the end of the test. It is a classic of the first few days.

Two more habits are worth more than any option. One is an encrypted disk (the installer offers it) and the other is a normal user instead of root for everyday work, with sudo only where needed. The VM, for its part, should not touch the home Wi-Fi except for declared targets.

Choosing the Tools to Install

Kali installs with the programs from the kali-linux-default metapackage. That covers almost everything a beginner needs. The kali-linux-large metapackage adds the rest of the catalog, and kali-linux-everything installs the lot, the typical choice for people who work offline. The documentation lists the metapackages by category and the kali-tweaks command lets you pick them from a menu (list of metapackages).

tools.sh bash
sudo apt install -y kali-linux-default
sudo apt install -y kali-tools-web kali-tools-passwords kali-tools-information-gathering

The tools to learn first are few. Nmap discovers hosts and open ports. Burp Suite (the free Community edition) and ZAP, OWASP's open source proxy, intercept and modify a website's traffic. Gobuster hunts for hidden directories. Sqlmap automates SQL injection testing, while Metasploit collects exploits and post-exploitation modules. NetExec, the fork that took the place of CrackMapExec, enumerates Windows services and Active Directory.

For passwords, Hashcat uses the GPU and John the Ripper works well on the CPU. Inside a virtual machine the host GPU is not visible, so serious cracking happens on the host (or on a dedicated computer, see above) and not in the VM. Hydra and Medusa try credentials against network services.

Warning. Many tools ship with default credentials known to everyone. BeEF uses beef/beef, the Metasploit PostgreSQL database postgres/postgres, Empire and Starkiller empireadmin/password123, BloodHound admin/admin. Change them on first launch, before exposing the service even to the home network.

Setting Up the Working Environment

A good environment shows in its tidiness. Every target gets a folder with the same structure (recon, exploit, evidence, report). Every important command leaves a trace. Kali uses Zsh as its default shell, so aliases and functions go in ~/.zshrc (not in .bashrc), and you reload the file with source ~/.zshrc.

~/.zshrc zsh
alias nmapquick='nmap -sV -T4 -Pn'
alias scanweb='nmap -p80,443 -sV --script=http-enum'
alias myip='ip -4 -br addr show'

mktestdir() {
  mkdir -p ~/tests/"$1"/{recon,exploit,evidence,report}
  cd ~/tests/"$1"
}

nmap_ports() {
  nmap -p- --min-rate=1000 -T4 "$1" | awk -F/ '/^[0-9]+\/tcp.*open/ {print $1}' | paste -sd, -
}

The nmap_ports function returns the open ports on a single comma-separated line, ready to pass to a slower scan with nmap -p. The -sS and -O options require root privileges, so in a script you prepend sudo.

An initial reconnaissance script creates the folders and launches the scan, then looks for directories in one pass. Run it only against authorized hosts.

recon.sh bash
#!/usr/bin/env bash
set -euo pipefail

target="${1:?usage: ./recon.sh <authorized host>}"
dir=~/tests/"$target"
mkdir -p "$dir"/{recon,exploit,evidence,report}

sudo nmap -sV -sC -O "$target" -oA "$dir/recon/nmap_initial"
gobuster dir -u "http://$target" -w /usr/share/wordlists/dirb/common.txt \
  -o "$dir/recon/gobuster.txt" || echo "no web service reachable"

Make the script executable with chmod +x recon.sh and run it with the target's address. To keep a history of the work, initialize Git in the test folder, after setting your identity once.

git-test.sh bash
git config --global user.name "First Last"
git config --global user.email "[email protected]"
cd ~/tests/TARGET_NAME
git init && git add . && git commit -m "Initial reconnaissance"

For notes, use CherryTree (hierarchical notes, part of the reporting metapackage), and to record a whole session use the script -a session.log command, which saves every line typed and printed. At the end of an engagement the notes can be exported to PDF with Pandoc.

A Lab to Practice In

Once Kali is installed, you need something legal to attack. Machines on a real network are never a target for learning. Purpose-built labs are plentiful. They install locally. OWASP Juice Shop is a deliberately vulnerable online store that starts in a Docker container. Metasploitable is a virtual machine full of breakable services. Platforms such as TryHackMe and Hack The Box offer guided paths, paid or free, with targets they host themselves.

juice-shop.sh bash
docker run --rm -p 3000:3000 bkimminich/juice-shop

The practice network should be isolated. In VirtualBox an internal or host-only network lets Kali and the target talk to each other without exposing either to the Internet. Anyone who wants to go further will find the "agentic" side of testing in our guide to ARTEX, the copilot for Kali reviewed in Kali GPT, and a practical case of testing your own application in Claude BugHunter. Those who prefer hardware can move on to the Flipper Zero guide, which pairs well with a radio-frequency lab.

What the Law Says

Downloading and using Kali is legal in the countries covered here. Attacking a system without the owner's permission is a crime almost everywhere. In the United States the reference is the Computer Fraud and Abuse Act (18 U.S.C. 1030), and in the United Kingdom the Computer Misuse Act 1990. European countries have their own versions. Italy has article 615-ter of the criminal code on unauthorized access to a computer system. In Germany, § 202c StGB, the so-called Hackerparagraph, also punishes preparatory acts, including producing and distributing programs designed to commit computer crimes.

The practical advice applies everywhere. Before touching a target that is not your own lab, get a written agreement covering the scope (addresses, domains, dates, times), file it in the report folder and stay inside the perimeter. On gray areas, such as vulnerability research without an engagement, the opinion of a lawyer who specializes in computer law costs less than a criminal proceeding.

Frequently Asked Questions (FAQ)

1. Can I use Kali Linux as my everyday operating system?

You can, but the project advises against it. Kali is built for security professionals and not for web development, gaming or general use. The repositories are minimal, adding outside packages can break the system, and always working as a privileged user with attack tools open is a bad habit. A dedicated virtual machine avoids all these problems.

2. Does Kali run on a Mac with an Apple chip?

Yes, with the arm64 image. The ARM installer is available in version 2026.3 and the official documentation describes using it with UTM and importing it into QEMU. Some tools with x86-specific code may behave differently, so it is worth trying your own tools before an engagement.

3. Is WSL2 enough to get started?

For learning the commands yes, for a full lab no. WSL2 runs on a virtualized network and does not give direct access to network cards, so sniffing and tests on local networks have to run in a virtual machine or on a dedicated computer.

4. How do I update a Kali that is already installed?

A full update is enough, with no reinstall. Kali is a rolling release, so sudo apt update && sudo apt -y full-upgrade brings the system to the latest version. You check it with grep VERSION /etc/os-release, which should show VERSION_ID="2026.3".

5. What are the weekly builds and should I use them?

They are images refreshed every week, for example 2026-W49, that do not go through the same quality checks as the releases. They suit people who want the latest supported hardware or a fix that just landed. For an ordinary lab the quarterly release is the most sensible choice.

Where to Start

The first concrete step is a verified, updated VM with a clean snapshot and the firewall on. The second is a target that can hurt no one, for example Juice Shop in a container on the same host-only network, to scan with nmapquick and explore with Burp. What you learn on the first target, noted down and saved in the Git history, helps you build the second. Kali should be taken for what it is, a workbench and not a system to use everywhere.

▸ pasqualepillitteri.it

Corrections and replies

Spotted an error, a typo or information that needs updating? Let us know. People and companies mentioned in our articles can also request a correction or send a reply. We review every request within 48 business hours and, if it is well founded, we publish the correction or the reply at the end of the article, as set out in our corrections policy.

pasqualepillitteri.it

Enjoyed the article?

Rate this article
★ ★ ★ ★ ★
Thanks for your rating!
Buy me a coffee
Share
Discussion Reply
Follow on Google
Newsletter FREE 1 email per week, Saturday morning Subscribe
Tech GearSecurity toolsBoard
Consulting
CorrectionsErrors, typos or right of replyReport
Open the discussion on X
FREE
✉
pasqualepillitteri.it

Stay updated

3k readers worldwide, every Saturday

Subscribe to the newsletter to receive new articles directly in your inbox.

  • Only useful stuff, zero spam
  • 1 email per week, Saturday morning
  • Unsubscribe anytime
By subscribing you accept data processing. Unsubscribe anytime. Email opens and clicks are measured only in aggregate, anonymous form. Privacy Policy · Terms
▸ pasqualepillitteri.it

Request a quote

PDF, DOC, DOCX, max 5MB