How to Run a Windows VM in VirtualBox on Debian 12 Bookworm

How to Run a Windows VM in VirtualBox on Debian 12 Bookworm

Running a Windows virtual machine (VM) on your Debian 12 Bookworm system can be an excellent way to access Windows-exclusive software without dual-booting or switching computers. VirtualBox is a powerful and open-source virtualization platform that makes this possible. In this article, we’ll walk you through the entire process of setting up VirtualBox and running a Windows VM, step by step.


Why Run Windows in VirtualBox on Debian?

There are many reasons to run Windows inside a VM on Debian:

  • Software compatibility: Some applications are available only for Windows.
  • Testing environments: Ideal for developers or IT professionals who need to test software in multiple operating systems.
  • Avoid dual-boot: You don’t need to reboot or partition your drive.
  • System isolation: Your Windows environment is contained, so it’s safer and easily restorable.

Prerequisites

Before we begin, make sure your system meets the following:

  • A computer running Debian 12 Bookworm with administrative (sudo) privileges.
  • At least 8 GB RAM (16 GB recommended).
  • At least 30 GB of free disk space.
  • A Windows ISO image (Windows 10 or 11).
  • A stable internet connection.

Step 1: Update Your System

First, let’s ensure your Debian system is fully updated.

Open a terminal and run:

sudo apt update && sudo apt upgrade -y

This command updates the package list and upgrades all installed packages to their latest versions.


Step 2: Install VirtualBox

Add the Debian Non-Free Repositories

VirtualBox requires some components from Debian’s “contrib” and “non-free” repositories. Edit the APT sources list:

sudo nano /etc/apt/sources.list

Ensure each Debian repository line includes contrib non-free like so:

deb http://deb.debian.org/debian bookworm main contrib non-free
deb http://security.debian.org/debian-security bookworm-security main contrib non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free

Save and exit the editor (Ctrl + O, Enter, Ctrl + X), then update:

sudo apt update

Install Required Packages

Now install VirtualBox and its dependencies:

sudo apt install virtualbox virtualbox-ext-pack -y

During the virtualbox-ext-pack installation, you’ll be prompted to accept a license agreement—press Tab and then Enter to accept.


Step 3: Add Your User to the vboxusers Group

To use USB and other features in VirtualBox, your user must be in the vboxusers group:

sudo usermod -aG vboxusers $USER

Log out and back in (or reboot) for the changes to take effect.


Step 4: Launch VirtualBox

Now that everything is set up, you can launch VirtualBox from your application menu or via terminal:

virtualbox

You should see the VirtualBox Manager GUI.


Step 5: Download a Windows ISO Image

If you haven’t already, download the ISO file for Windows:

Make sure to download the correct version for your system architecture (usually 64-bit).


Step 6: Create a New Virtual Machine

With VirtualBox open, follow these steps:

  1. Click “New” in the top-left corner.
  2. Name the VM: e.g., “Windows 10”.
  3. Folder: Choose where you want to store the VM.
  4. ISO Image: Click the dropdown and choose your downloaded Windows ISO.
  5. Type: Select “Microsoft Windows”.
  6. Version: Choose “Windows 10 (64-bit)” or “Windows 11 (64-bit)”, depending on your ISO.
  7. Click Next.

Step 7: Allocate Memory and CPU

You’ll now configure the system resources:

  • Memory (RAM): Allocate at least 4096 MB (4 GB). For better performance, consider 8 GB or more if you have enough.
  • CPUs: Allocate at least 2 CPUs. If you have a quad-core, you can assign 2 or 3.

Click Next when done.


Step 8: Create a Virtual Hard Disk

Choose Create a Virtual Hard Disk Now:

  • Disk size: Minimum 30 GB; 50 GB is recommended for Windows + applications.
  • File type: Leave it as VDI (VirtualBox Disk Image).
  • Storage on physical hard disk: Choose Dynamically allocated unless you want to pre-allocate space.
  • Click Create.

Step 9: Fine-Tune VM Settings

Before starting the VM, let’s tweak a few settings.

  1. Select your VM and click Settings.
  2. System → Motherboard:
    • Uncheck “Floppy” from the boot order.
  3. System → Processor:
    • Enable “PAE/NX”.
    • Check “Enable Nested VT-x/AMD-V” if available.
  4. Display → Screen:
    • Increase Video Memory to 128 MB.
    • Enable 3D Acceleration.
  5. Storage:
    • Confirm that the ISO is attached as a virtual optical disk.
  6. USB (Optional):
    • Enable USB 2.0 or USB 3.0 controller if you plan to use USB devices in the VM.

Click OK to save settings.


Step 10: Start the VM and Install Windows

Click Start to boot your VM using the attached ISO. The Windows installer will begin.

Follow the on-screen instructions:

  1. Choose your language and region.
  2. Enter your license key or select “I don’t have a product key”.
  3. Choose the Windows edition you want (e.g., Windows 10 Pro).
  4. Select “Custom: Install Windows only (advanced)”.
  5. Choose the virtual hard disk to install Windows.
  6. Let the installation complete (this may take a while).

Once installed, Windows will reboot and walk you through the user setup.


Step 11: Install VirtualBox Guest Additions

Guest Additions significantly improve VM performance and usability (e.g., better graphics, clipboard sharing, folder sharing).

  1. From the VirtualBox menu bar, go to Devices → Insert Guest Additions CD image.
  2. In Windows, open the mounted CD drive and run VBoxWindowsAdditions.exe.
  3. Follow the installation prompts.
  4. Reboot the Windows VM when prompted.

Step 12: Enable Shared Clipboard and Drag & Drop

After installing Guest Additions, enable shared features for convenience:

  • Go to Devices → Shared Clipboard → Bidirectional.
  • Go to Devices → Drag and Drop → Bidirectional.

These features allow copying text and files between host and guest.


Step 13: (Optional) Create Shared Folders

To share folders between Debian and Windows:

  1. Go to VM Settings → Shared Folders → Add New Shared Folder.
  2. Choose a folder path on the host.
  3. Enable Auto-mount and Make Permanent.
  4. Inside Windows, you’ll find it mounted as a network drive after rebooting.

Performance Tips

  • Allocate enough memory and CPU cores to your VM.
  • Install Guest Additions for a smoother experience.
  • Enable 3D acceleration if your graphics card supports it.
  • Use dynamically allocated disks for flexibility with storage.

Common Troubleshooting

  • Black screen or crash on boot: Ensure VT-x is enabled in your BIOS/UEFI.
  • Mouse not captured properly: Try installing Guest Additions again.
  • USB devices not detected: Ensure you’re in the vboxusers group and USB controller is enabled.
  • Slow performance: Allocate more RAM/CPU, or try switching from SATA to NVMe in VM storage settings.

Conclusion

Running a Windows VM in VirtualBox on Debian 12 Bookworm is not only feasible but also highly effective for a wide range of use cases. Whether you’re a developer needing cross-platform support or just someone who occasionally needs access to Windows-only applications, this setup provides flexibility, isolation, and convenience.

With the help of VirtualBox and a few configuration tweaks, you can enjoy the power of Debian while seamlessly integrating Windows when needed—all without leaving your primary operating system.

If you found this guide helpful, consider bookmarking it for future reference or sharing it with fellow Linux enthusiasts. Happy virtualizing!