You are currently viewing How to Install Kali Linux on VirtualBox: A Step-by-Step Guide

How to Install Kali Linux on VirtualBox: A Step-by-Step Guide

Kali Linux is the industry standard for penetration testing and security research, but installing it directly on your hardware can introduce risks for beginners — accidental misconfigurations, driver conflicts, or even unintended network exposure. Running Kali inside VirtualBox gives you a fully isolated lab environment where you can experiment, break things, and learn without affecting your host system. This guide walks you through every step, from downloading the correct ISO to configuring network modes and applying post-install tweaks.

Prerequisites: What You Need Before You Start

Before you begin, make sure your host machine meets these requirements:

  • VirtualBox – Download and install the latest version from the official Oracle VirtualBox website. Version 7.0 or newer is recommended for better performance and security features.
  • Kali Linux ISO – Go to the official Kali Linux downloads page and grab the 64-bit installer image (not the live or weekly builds unless you prefer a rolling release). The “Installer” image includes a full desktop environment and toolset.
  • At least 4 GB of RAM – Allocate 2–4 GB to the VM. 8 GB total on the host is comfortable.
  • At least 20 GB of free disk space – A dynamically allocated VDI file will grow as you install tools, but 20 GB is a safe minimum.
  • Virtualization enabled in BIOS/UEFI – Intel VT-x or AMD-V must be turned on for 64-bit guests. Check your system firmware settings.

Step 1: Create a New Virtual Machine

Open VirtualBox and click the New button. Give your VM a name — for example, "Kali Linux Lab" — and set the type to Linux and version to Debian (64-bit). Kali is based on Debian testing, so this selection provides the correct defaults.

In the memory size step, assign at least 2048 MB (2 GB). For smoother performance with modern tools like Burp Suite or Metasploit, use 4096 MB if your host can spare it. On the hard disk screen, choose Create a virtual hard disk now, select VDI (VirtualBox Disk Image), and pick Dynamically allocated. Set the size to 20–30 GB.

Creating a new virtual machine in VirtualBox with Debian 64-bit type

Step 2: Configure System Settings

Before booting the VM, adjust a few critical settings by selecting the VM and clicking Settings.

System > Processor

Assign 2 CPU cores if your host has at least 4 logical cores. Enable PAE/NX and VT-x/AMD-V (the latter should be auto-detected if virtualization is enabled in BIOS).

Display > Video

Increase video memory to 128 MB and enable 3D Acceleration. This makes the Kali desktop (XFCE by default) much more responsive.

Storage

Under the Controller: IDE or SATA section, click the empty optical drive icon and choose Choose a disk file. Browse to the Kali ISO you downloaded. This will be the installation medium.

Network

This is where many beginners make mistakes. For a safe learning environment:

  • NAT (default) – The VM can access the internet but is not reachable from the host or other network devices. Good for downloading updates and tools.
  • Host-Only Adapter – The VM can communicate only with the host and other VMs on the same host-only network. Ideal for isolated labs.
  • Bridged Adapter – The VM appears as a separate device on your physical network. Use only if you know exactly what you are doing and have permission to scan devices on that network.

For this guide, start with NAT. After installation, you can add a second Host-Only adapter for internal lab communication.

VirtualBox network adapter settings showing NAT, Host-Only, and Bridged options

Step 3: Install Kali Linux

Start the VM. The Kali boot menu appears. Select Graphical Install (or Install if you prefer text mode). The installer will ask for:

  • Language, location, keyboard layout – Choose your preferences.
  • Hostname – Leave as kali or change it.
  • Domain – Leave blank unless you have a specific domain.
  • Root password – Set a strong password. This is the superuser account.
  • Disk partitioning – Choose Guided – use entire disk and select the virtual disk. Confirm the changes when prompted.

The installer copies files and installs the base system. When it asks about a desktop environment, keep Xfce selected (it is lightweight and works well on VirtualBox). You can also tick Kali Linux default tools to pre-install the full toolset. If you are short on disk space, you can install tools later via apt.

After installation completes, the VM reboots. Log in with the root account and password you set.

Step 4: Install VirtualBox Guest Additions

Guest Additions provide better screen resolution, mouse integration, shared clipboard, and drag-and-drop. Without them, the Kali desktop will feel sluggish and stuck at 800×600 resolution.

  1. From the VirtualBox menu, click Devices > Insert Guest Additions CD image.
  2. In the Kali terminal, mount the CD and run the installer:
    mount /dev/cdrom /mnt
    cd /mnt
    ./VBoxLinuxAdditions.run
  3. If you get a kernel header error, install the required packages first:
    apt update
    apt install -y linux-headers-$(uname -r) build-essential

    Then rerun the installer.

  4. Reboot the VM. You should now see a full-screen desktop and smooth mouse movement.

Step 5: Post-Installation Security and Updates

Even in a lab environment, keep your Kali installation up to date:

apt update && apt upgrade -y

Consider creating a non-root user for daily work. While Kali traditionally uses root, many modern tools work fine under a regular user with sudo. Create a user:

useradd -m -G sudo student
passwd student

Then log out and log in as that user. This reduces the risk of accidental system damage.

Take a snapshot of the clean VM. In VirtualBox, go to Machine > Take Snapshot. Name it "Clean Install". Snapshots let you roll back to a known good state if you break networking or install a malicious tool accidentally.

Network Mode Recommendations for Different Scenarios

Scenario Recommended Network Mode Why
Learning command-line tools (nmap, netcat) NAT Safe internet access, no exposure to LAN
Practicing web app testing (DVWA, Metasploitable) Host-Only Isolated lab; host and VMs only
Simulating real-world network attacks (with permission) Bridged VM gets its own IP on the physical network
Multiple VMs communicating Internal Network VMs talk to each other, no host or internet

Always start with the most restrictive network mode and expand only when you understand the implications. Never use Bridged mode on a network you do not own or have explicit written permission to test.

Common Pitfalls and How to Avoid Them

  • VM won't boot after installation – Remove the ISO from the virtual optical drive. Go to Settings > Storage, select the ISO, and click the disc icon to choose Remove disk from virtual drive.
  • Guest Additions fail to install – Ensure you have installed the correct kernel headers. The linux-headers-$(uname -r) command must match the running kernel. Reboot after installing headers.
  • Network not working after switching to Host-Only – In VirtualBox, go to File > Host Network Manager and create a new host-only network with DHCP enabled. Then assign that adapter to the VM.
  • Low disk space – Use df -h to check usage. If needed, increase the virtual disk size via VBoxManage modifyhd and then expand the partition inside the VM with GParted.

Once Kali is running smoothly in VirtualBox, the next step is to set up a target VM (like Metasploitable 2 or a deliberately vulnerable web app) on the same host-only network. This gives you a complete lab for practicing ethical hacking techniques — all within the legal and safe boundaries of your own machine.