Sub topic 9
Setting up a virtual machine lab
This chapter assumes you can install desktop software and know basic hardware terms such as RAM and storage. A virtual machine (VM) is a software-emulated computer that runs inside your real one, called the host. The operating system inside the VM is the guest. A VM lab lets you break and repair systems without risking your own PC.
What the lab needs
Aim for at least one Windows guest and one Linux guest. Together they cover most of the Core 2 operating system objectives and give you somewhere to practice the networking and command-line work in later chapters.
| Resource | Minimum host | Why |
|---|---|---|
| RAM | 16 GB | Two guests at 4 GB each, plus the host |
| Free disk | 100 GB | A Windows guest alone uses 50 GB or more |
| CPU | 4 cores with virtualization enabled | Each guest gets two virtual CPUs |
Virtualization is often switched off by default. Enable Intel VT-x or AMD-V in the firmware settings, or the hypervisor will fail to start 64-bit guests. A hypervisor is the program that creates and runs VMs. VirtualBox is free, so this chapter uses it.
The setup workflow
Creating a Windows guest
These commands register a Windows 11 VM and give it 4 GB of RAM and two CPUs:
VBoxManage createvm --name "APlus-Win11" --ostype Windows11_64 --register
VBoxManage modifyvm "APlus-Win11" --memory 4096 --cpus 2The VM cannot boot yet. You still need to attach a virtual disk and an installation ISO, which you can do in the VirtualBox window. Windows 11 expects UEFI firmware and a TPM, and VirtualBox 7 can provide both. If setup rejects the VM, use a Windows 10 evaluation image instead. Repeat the process with an Ubuntu ISO for the Linux guest.
Snapshots
A snapshot saves a VM's exact state so you can return to it later. Take one right after installation and updates, while the guest is clean. Before each practice scenario, such as corrupting a system file or misconfiguring DNS, take another. Restoring a snapshot takes seconds, so you can repeat a fault as many times as you need.
Common errors
- The guest will not start 64-bit: virtualization is disabled in firmware, or another hypervisor such as Hyper-V is holding it.
- The guest is very slow: you gave it too much RAM, so the host is swapping. Leave at least 4 GB for the host.
- No network in the guest: the default NAT mode gives the guest internet access but hides it from other machines. Use an internal or bridged adapter later, when you practice networking.
Exercise
You have 16 GB of host RAM and plan to run one Windows and one Linux guest together. Why is giving each guest 8 GB a poor choice?
Show answer
The two guests would take all 16 GB and leave nothing for the host, so the host would swap to disk and everything would slow down. Give each guest about 4 GB and leave at least 4 GB for the host.