How to Install Windows in VirtualBox in Linux

A picture showing a laptop keyboard with a focus on the Windows key.

There are several reasons a Linux user would want to create a Windows virtual machine, and VirtualBox is easily one of the most popular hypervisors available for Linux. It’s simple to use, easily accessible, and extremely flexible in what it allows you to do with your virtual machines. In this guide, you’ll learn how to install Windows in VirtualBox in Linux.

Tip: other than Windows, you can also install macOS in Virtualbox.

Installing VirtualBox

There are two ways to install VirtualBox in Linux. The first is to go to the website and download whichever package works for your system. Follow the steps below:

  1. Go to the project website and click the big “Download VirtualBox 7.0” button.
A screenshot of the VirtualBox website.
  1. Click “Linux distributions” on the Downloads page.
A screenshot of the VirtualBox website's download page.
  1. You’ll be brought to a list of compatible Linux distros on which you can install VirtualBox. Click whichever one you’re looking for.
A screenshot of the VirtualBox website's download page for Linux.
  1. Follow the download prompts, and the package installer should automatically install the package.
A screenshot of the VirtualBox deb package's installation page.

However, there are some challenges with that. Generally, just installing the RPM or DEB will miss building the kernel modules necessary, which can bring up many errors. The way to get around that is to install VirtualBox from your distro’s repository. This is usually a simple command to install, depending on your distribution.

For Ubuntu and its derivatives:

sudo apt install virtualbox virtualbox-guest-additions-iso
A terminal window showing the VirtualBox installation process using apt.

Downloading Windows 11

For those who may not be aware, Windows 11 is actually free to download and use. You can’t use it in a production environment without paying for it, but if it’s purely for personal purposes, it’s fair game.

  1. Download Windows 11 by going to Microsoft’s Windows Download page.
A screenshot of Microsoft's Windows download page.

Tip: aside from installing Windows from an ISO, you can also download an official VM image for Windows that comes already configured for VirtualBox.

  1. Scroll down to where it says “Download Windows 11 Disk Image for x64 devices.” Choose whichever is the latest edition and click “Download.”
A screenshot showing the download selection page for Windows 11.
  1. Choose your product language and click “Confirm” again. Unlike previous versions, Windows 11 does not come with a 32-bit version. To download the ISO, click the “64-bit Download” button.
A screenshot of the Windows 11 ISO download page.

Note: the download may take a while, especially on a slow network connection, as the ISO image is almost 5GB in size.

Once you click “64-bit Download” and save it to your machine, you’re ready to create your Windows 11 virtual machine in VirtualBox.

Do you know: other than VirtualBox, you can also install Windows 11 in Raspberry Pi.

Creating the Windows 11 Virtual Machine

  1. Once your download is finished, open VirtualBox and click “New.”
A screenshot of the VirtualBox 7.0 landing page.
  1. Type “Windows 11” in the “Name” section. That will automatically choose the “Version” to “Windows 11 (64-bit).” From there, name it anything you want.
A screenshot showing the VM setup process for Windows 11.
  1. Click the “ISO Image” textbox and select “Other.” This will open a small dialog box where you can select the Windows 11 ISO image that you obtained earlier.
A screenshot showing the File Picker window selecting the Windows 11 ISO.
  1. Once you have the ISO loaded, click “Next.”
A screenshot showing the loaded ISO image in VirtualBox.
  1. Go to the “Username and Password” group and write the credentials you want for your Windows 11 account.
A screenshot of the user creation dialog in VirtualBox.
  1. Go to the “Additional Options” group. Change the values in both the “Hostname” and “Domain Name” textboxes. For this, you can write any value that you want as long as the Domain Name is two characters long.
A screenshot showing the hostname and domain name of the VM.
  1. Click the “Guest Additions” checkbox and click “Next.”
A screenshot showing the Guest Additions option in VirtualBox.
  1. Go through the menu and set whatever you’d like for the configuration of the virtual machine. I’d recommend at least 4096MB memory and creating a 60GB virtual disk.
A screenshot showing the disk setup window in VirtualBox.
  1. After you are done creating your virtual machine, VirtualBox will automatically start and install Windows 11 in the background.
A screenshot showing the automatic Windows 11 installation process.

Once Windows is installed, you may notice that it’s complaining about inadequate video drivers and that you’re limited to a very small screen. To fix all that, you will need to install VirtualBox Guest Additions.

Installing VirtualBox Guest Additions in Windows

  1. With the VM running, click the “Devices” menu item and select “Insert Guest Additions CD Image.”
A screenshot showing the mounting of the Guest Additions ISO.
  1. Open the File Explorer and click on “This PC.” You should see the icon for the Guest Additions CD Image on the bottom next to “Local Disk (C:).” Click on the Guest Additions CD Image icon.
A screenshot showing the mounted Guest Additions ISO in the VM.
  1. Click on “VBoxWindowsAdditions” and “Yes” on the UAC dialogue.
A screenshot showing the Guest Additions binary inside the ISO.
  1. Click “Next” through the installer dialogue, accepting all defaults. Additionally, click “Install” when you get the dialogue asking to trust software from Oracle.
A screenshot showing the Guest Additions installation wizard.
  1. Once the installation is finished, click “Finish,” and your VM will reboot.
A screenshot showing the reboot confirmation in the Guest Additions installer.
You can choose to reboot now or do it later.

With that done, the Guest Additions are installed, and you can experience true 3D acceleration, screen size selection, and many of the other great benefits that come with using VirtualBox Guest Additions, like shared clipboards and file sharing from Host to Guest and back.

A screenshot of Windows 11 in the proper aspect ratio.
Note that the VM is now full screen.

Tip: learn how to share USB and network devices in VirtualBox.

Transferring Files from Linux to Windows 11

Another benefit of enabling VirtualBox Guest Additions is that it allows you to seamlessly transfer files between your host Linux machine and Windows 11. This can be helpful if you are using your VM for data processing and need a way to push and pull files from your guest operating system. To get started, follow the steps below:

  1. Click the “Machine” menu item, then “File Manager.”
A screenshot showing the File Manager option in VirtualBox.
  1. Provide the user credentials for your guest operating system and click “Open Session.”
A screenshot of the File Manager window in VirtualBox.
  1. From here, you can transfer files from your host to your guest machine by clicking a file under the “Host File System” picker.
A screenshot showing the Host File System Picker side of the File Manager.
  1. Go to your “Guest File System” picker and click the “Home” icon on top of the picker box.
A screenshot showing the Guest File System Picker side of the File Manager.
  1. Click the “Right Arrow” button in between the Host and Guest file pickers.
A screenshot showing the File Transfer button in the middle of the File Manager window.

Creating a Permanent Shared Folder in VirtualBox

While using the File Manager utility allows you to transfer files from your host to your guest OS, there are instances where you might need a more permanent channel between them. To this end, VirtualBox provides a “Shared Folder” feature, which is used to create a link between your two machines.

  1. Click the “Devices” menu item in the guest OS’s menu bar.
A screenshot showing the contents of the Device Menu entry.
  1. Hover amd slide over to the “Shared Folders” item, then click the “Shared Folders Settings.”
A screenshot showing the Shared Folders Settings submenu.
  1. Click the small Folder Icon in the setting window’s upper right sidebar.
A screenshot showing the Shared Folders window in VirtualBox.
  1. Click the “Folder Path” drop-down list, then click “Other.”
A screenshot showing the Share Folder creation prompt.
  1. Select the folder that you want to use in your host OS from the File Picker menu.
A screenshot showing the File Picker menu for the Share Folder.
  1. Provide a simple name describing your new folder, then click the “Auto-Mount” checkbox.
A screenshot showing the properly set-up shared folder.
  1. Click “OK” on both the “Add Share” and “Shared Folders Settings” windows.
A screenshot showing the shared folders window prompt.

You can access your folder in the guest OS by going to the File Explorer, then clicking “This PC.”

A screenshot showing the mounted shared folder in the VM.

Good to know: while a Share Folder allows you to back up files inside your VM, you can also make an OVA file in VirtualBox, which will create a reproducible image that you can reinstall at anytime.

Frequently Asked Questions

Why does my Windows 11 VM keep crashing on startup?

While this can be due to a number of issues, the most common cause for this is a BIOS setting that disabled your machine’s virtualization features. To fix this issue, go into your system’s BIOS and enable any setting that contains either an Intel VT-x/VT-d or AMD-V.

How do I fix my VM, as it's slow and sluggish when running?

This is most likely due to a lack of available system resources in your host machine. As such, you can fix this by making sure that VirtualBox is the only heavy program that is running whenever you boot a guest operating system.

Why am I getting a UEFI Shell whenever I boot my Windows 11 ISO?

This happens whenever VirtualBox tries to load a guest operating system using UEFI. By default, VirtualBox only uses UEFI as a fallback mode for pickier operating systems and will not boot Windows 11 under UEFI.

Image credit: Unsplash. All alterations and screenshots by Ramces Red.

Is this post useful?
Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Ramces Red
Ramces Red - Staff Writer

Ramces is a technology writer that lived with computers all his life. A prolific reader and a student of Anthropology, he is an eccentric character that writes articles about Linux and anything *nix.