LESSON 08 · BEGINNER10 min read

Install VirtualBox, Ubuntu, and Kali Step by Step

Build an isolated two-machine lab, verify that virtualization and networking work, and take the snapshots that make every later experiment recoverable.

OWASP Top 10 · MITRE ATT&CK · NIST CSF 2.0Free to readModule 3 of 14
YOUR NEXT SMALL WINS

By the end, you’ll be able to…

  • Check hardware virtualization, memory, and disk space before installing anything.
  • Download VirtualBox, Ubuntu, and Kali from official sources and verify their checksums.
  • Create Ubuntu and Kali virtual machines with safe CPU, RAM, disk, and network settings.
  • Prove that the lab is isolated, take useful snapshots, and reset a guest to a known-good state.

01Plan the Lab Before You Install Anything

A virtual machine (VM) is a complete computer running as software on your computer. The physical machine is the host; each VM is a guest. VirtualBox is the hypervisor, the program that provides each guest with virtual hardware: a disk, a network card, a screen, and a keyboard. A guest cannot read the host's files unless you deliberately share a folder, which makes a VM the right place to install security tools and intentionally vulnerable applications.

Before you download anything, check three resources: CPU virtualization support, memory, and free disk. You need a 64-bit processor with Intel VT-x or AMD-V enabled. 16 GB of RAM is the recommended amount for running Ubuntu and Kali together; 8 GB works if you run one VM at a time. Plan for about 80 GB of free disk space, preferably on an SSD. A comfortable split is 4 GB of RAM and 2 virtual CPUs per guest, 30 GB for Ubuntu, and 35 GB for Kali, leaving the rest for ISOs, snapshots, and a Windows Server VM if you take the Active Directory module.

Check the host before you install. On Windows, open Task Manager, select Performance, then CPU, and look for Virtualization: Enabled. In PowerShell, systeminfo | Select-String 'Virtualization' also reports whether firmware virtualization is enabled. On Linux, run lscpu | grep -i virtualization, or count the CPU flags with grep -Ec '(vmx|svm)' /proc/cpuinfo; a result greater than zero means the feature is exposed. On macOS, Intel and Apple silicon machines use different hypervisors, so follow the VirtualBox documentation for your platform.

If virtualization is disabled, enable Intel VT-x or AMD-V in the host UEFI/BIOS. On Windows, Hyper-V, Virtual Machine Platform, and memory integrity can claim the virtualization extensions. VirtualBox 7 can share the Windows hypervisor, but guests may run more slowly. Do not disable security features just to make a lab work; understand the trade-off first. If the option is missing, check the manufacturer's manual and whether the host is itself a VM.

Choose a folder for virtual machines that is not synced to a cloud service by default. Give files clear names: cyber-ubuntu, cyber-kali, and a notes folder outside the VMs. You will rebuild these machines more than once, so record the host operating system, VirtualBox version, ISO versions, and download dates in a lab notebook from day one.

check-host.shShell
# Linux host: count CPU flags that expose hardware virtualization.grep -Ec '(vmx|svm)' /proc/cpuinfolscpu | grep -i virtualization# Check free disk space and memory on the host.df -hfree -h# Inside either guest: identify the lab address and route.ip -brief addressip route
Outputstdout
8
Virtualization:                  VT-x
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       476G  212G  240G  47% /
               total        used        free
Mem:            31Gi       9.0Gi        18Gi
lo               UNKNOWN        127.0.0.1/8
enp0s3           UP             10.10.10.20/24
default via 10.10.10.1 dev enp0s3

02Download and Verify the Installation Media

Download VirtualBox only from the official downloads page at virtualbox.org/wiki/Downloads. Pick the build for your host operating system. The Extension Pack adds USB 2.0 and 3.0 support, virtual disk encryption, and other features, but it has a separate licence; read it before installing. This course does not require the Extension Pack.

For Ubuntu, use the tutorials at ubuntu.com/tutorials and download Ubuntu Desktop 24.04 LTS or Ubuntu Server 24.04 LTS. Desktop is easier for a first lab because settings and browsers are graphical; Server uses less memory and is closer to a real server. Both are fine. For Kali, start at kali.org/docs/ and choose either the installer ISO or the prebuilt VirtualBox image. The prebuilt image is faster to start but ships with default credentials and a standard disk layout; change the password and snapshot immediately.

Downloading is not the same as trusting. Every official download page publishes a SHA-256 checksum. On Linux or macOS, run sha256sum against the downloaded file. On Windows, run certutil -hashfile FILE SHA256 in Command Prompt. Compare the result with the published value character by character. If it differs, delete the file and download again. A mismatch can mean a corrupted download or a tampered file; never install it.

Keep the ISO files in a folder such as lab-isos, or record the exact version and URL so you can download them again. Do not use random mirrors, torrents, or preconfigured hacking images from unknown sites. A malicious appliance can include a backdoor, a keylogger, or a hidden network service. The lab is meant to teach you to trust evidence, not to trust convenience.

Disk planning matters because snapshots grow. A 25 GB dynamic disk does not use 25 GB at once, but it expands as files are written. Each snapshot keeps changed blocks, so a busy VM with several snapshots can consume far more than the original size. Keep at least 15 to 20 GB free beyond your planned allocation, and check the host's free space before every snapshot.

03Create the Ubuntu and Kali Virtual Machines

Open VirtualBox Manager and choose New. Name the VM cyber-ubuntu, select Linux and Ubuntu (64-bit), and give it 4096 MB of memory and 2 CPUs. Create a virtual disk of 25 GB, VDI format, dynamically allocated. Attach the Ubuntu ISO when prompted and start the machine. Use a non-root user such as analyst, a unique lab password, and the default guided install. You can skip third-party media and unnecessary extras.

After the first boot, update the guest with sudo apt update and sudo apt upgrade -y. Install Guest Additions so the VM can share the clipboard, resize the display, and use shared folders. Insert the Guest Additions CD from the Devices menu, then install the build tools and kernel headers with sudo apt install -y build-essential dkms linux-headers-$(uname -r). Mount the CD, run sudo ./VBoxLinuxAdditions.run, and reboot. On Kali, the official documentation recommends the virtualbox-guest-x11 package; follow the Kali docs rather than mixing installers.

Create the Kali VM the same way: 4096 MB of memory, 2 CPUs, and a 40 GB disk. If you imported the prebuilt image, confirm the default credentials, change the password, update the package lists, and install Guest Additions. Name the VM cyber-kali. Do not give either VM more virtual CPUs than the host has physical cores; overcommitting makes both guests slow and can make timing-based tools unreliable.

Set up two network adapters. Adapter 1 is NAT, which lets the guest download updates through the host. Adapter 2 is Host-only Adapter, connected to a host-only network you create in File > Tools > Network Manager. Name it vboxnet0, set IPv4 to 10.10.10.1/24, and either enable DHCP for 10.10.10.100 to 10.10.10.200 or assign static addresses. Put Ubuntu at 10.10.10.20 and Kali at 10.10.10.10. Interface names vary; check with ip -brief address.

If the second adapter has no address, open the guest's network settings, run sudo dhclient INTERFACE for DHCP, or configure a static address. On Ubuntu Server, edit the netplan YAML and run sudo netplan apply. Test from Kali with ping -c 2 10.10.10.20, then test from Ubuntu with ping -c 2 10.10.10.10. If both work, the lab network exists. Record the addresses, adapter names, and MAC addresses in your notebook.

Shared folders are optional but useful. In the VM settings, add a folder, enable automount, and after boot add your user to the vboxsf group with sudo usermod -aG vboxsf $USER. Log out and back in. Set Shared Clipboard to Bidirectional in the Devices menu. Remember that a shared folder is a bridge between host and guest; never share your whole home directory or a folder containing real credentials.

04Isolate, Snapshot, and Recover

VirtualBox offers three useful network modes. NAT gives a guest outbound internet access but no inbound connections from the network. Host-only connects guests to the host and to each other on a private virtual network, with no route to your home LAN or the internet. Internal Network connects guests only to each other, with no host involvement. Bridged connects a guest directly to your physical LAN, as if it were another computer on the network. Avoid bridged mode for this course.

The lab design is simple: Ubuntu and Kali both have a host-only adapter on 10.10.10.0/24, and NAT is enabled only when you need updates. When you run a tool, disable or unplug NAT so a mistake cannot reach the internet. In VirtualBox, untick Cable Connected for Adapter 1, or use the guest's network settings to bring the interface down. Verify isolation rather than assuming it.

Run hostname, ip -brief address, and ip route in each guest. The route table should show the lab subnet and no default route through a home router. From Kali, ping the Ubuntu guest and confirm replies. Then try to reach your home router and a public website. Both should fail on a host-only-only lab. If either succeeds, find out why before you install a single security tool. A tool that can reach the internet can reach systems you do not own.

Snapshots capture the state of a VM at a moment in time. Take one immediately after the clean install, before installing tools, before changing the network, and before running a new tool. Name snapshots with a number and a reason: 01-clean-install, 02-network-verified, 03-toolkit-installed. Power off the VM before taking a snapshot for the most consistent disk state. Snapshots are not backups: if the physical disk fails, the VM and its snapshots are lost together. Export an OVA occasionally and keep important notes on the host.

The reset procedure is a skill you will use constantly. Power off the guest with sudo poweroff. In VirtualBox Manager, select the VM, open Snapshots, choose the clean snapshot, and restore it. Start the VM, verify the IP address and route, verify that one tool still runs, and record the reset in your notebook. Take a fresh snapshot after the reset if you plan to install something new. Write the procedure down; future you will not remember which snapshot was safe.

Troubleshooting is part of lab work. If VirtualBox reports VT-x or AMD-V unavailable, check firmware settings and host hypervisor conflicts. If host-only networking has no internet, that is expected; attach NAT temporarily for updates. If the clipboard or shared folder stops working, reinstall Guest Additions and re-check group membership. If the guest is slow, reduce video acceleration, give it fewer CPUs, or close other memory-hungry applications. Change one variable at a time and record what you changed.

verify-isolation.shShell
# Run inside the Kali guest.hostnameip -brief addressip route# The Ubuntu guest should answer on the lab network.ping -c 2 10.10.10.20# These should fail on a host-only-only lab.# Use your own router address only if it differs from this example.ping -c 1 192.168.1.1curl -I --max-time 5 https://example.com# Record the evidence before you change anything.date -u
Outputstdout
cyber-kali
lo               UNKNOWN        127.0.0.1/8
enp0s8           UP             10.10.10.10/24
10.10.10.0/24 dev enp0s8 proto kernel scope link src 10.10.10.10
PING 10.10.10.20 (10.10.10.20) 56(84) bytes of data.
64 bytes from 10.10.10.20: icmp_seq=1 ttl=64 time=0.42 ms
64 bytes from 10.10.10.20: icmp_seq=2 ttl=64 time=0.45 ms
ping: connect: Network is unreachable
curl: (6) Could not resolve host: example.com
LET IT CLICK

The ideas worth keeping.

  • A lab is a host, a hypervisor, and isolated guests with enough resources to run safely.
  • Download from official sources and verify checksums before you install anything.
  • Host-only networking is for experiments; NAT is a temporary update path.
  • Snapshots make mistakes recoverable, but they are not backups and they consume disk space.
TURN UNDERSTANDING INTO SOMETHING YOU CAN DO

Make it yours.

Type and test your code right here in the interactive workspace. Run your solution, check the output, and compare with the worked guide when ready.

01

Exercise 1: Check the host and plan the split

Run the virtualization and resource checks on your host. Record the exact output, then choose RAM, CPU, and disk values for an Ubuntu VM and a Kali VM. Explain how you left enough resources for the host and why snapshots change your disk budget.

Explore a worked solution
one_possible_solution.mdCybersecurity
Windows PowerShell: systeminfo | Select-String 'Virtualization' prints 'Virtualization Enabled In Firmware: Yes'. Linux: grep -Ec '(vmx|svm)' /proc/cpuinfo returns a count greater than zero, and lscpu | grep -i virtualization prints VT-x or AMD-V.

df -h shows free disk; free -h shows memory. On a 16 GB host, give Ubuntu 4 GB and 2 CPUs, Kali 4 GB and 2 CPUs, and leave about 8 GB for the host. On an 80 GB free disk, 30 GB for Ubuntu plus 35 GB for Kali leaves 15 GB for ISOs, snapshots, and an optional Windows Server VM. Record the numbers and check again before the first snapshot.

The host must remain usable while both guests run. Dynamic disks and snapshots grow, so a plan that exactly fills the disk is a plan for a failed snapshot or a corrupted VM.

02

Exercise 2: Prove the lab is isolated

Create a host-only network for Ubuntu at 10.10.10.20 and Kali at 10.10.10.10. Write the steps and commands you would use to prove that the guests can reach each other but cannot reach your home router or the public internet.

Explore a worked solution
one_possible_solution.mdCybersecurity
1. In VirtualBox, open File > Tools > Network Manager and create vboxnet0 with IPv4 10.10.10.1/24 and DHCP 10.10.10.100-200.
2. Set Adapter 2 on both VMs to Host-only Adapter, vboxnet0. Disconnect Adapter 1 (NAT) before the isolation test.
3. In Kali, run ip -brief address and ip route. Confirm 10.10.10.10/24 and a route for 10.10.10.0/24 only.
4. Run ping -c 2 10.10.10.20 and confirm replies from Ubuntu.
5. Run ping -c 1 192.168.1.1 and curl -I --max-time 5 https://example.com. Both should fail. If either succeeds, find the extra route or adapter before continuing.
6. Save the terminal output and take a snapshot named 02-network-verified.

Isolation is a property you test from the guest, not a checkbox in the hypervisor. A successful ping to the lab peer and a failed request to the outside prove two different boundaries.

A SMALL QUESTION. A USEFUL NEXT STEP.

What stayed with you?

Check the ideas while they’re fresh. Your answers stay in this page and feedback appears as you go.

A LITTLE ACTIVE RECALL0 / 3 answered
01Why should the lab VMs use a host-only adapter instead of a bridged adapter?
02What is the main purpose of a VirtualBox snapshot?
03A guest on a host-only network cannot reach the internet. What is the correct interpretation?

Keep exploring.

The official references behind this lesson, when you want a second angle or the full details.

One lesson closer.

Reading is a start. Trying it yourself makes the connection.

Completion is saved in this browser. It records reading and hands-on practice progress.