How to Set Up a Windows Virtual Machine in Linux
Need to run Windows software on Linux? One easy method is to install Windows in a virtual machine.
Preferable to relying on Wine or dual booting, using virtualization gives the Windows virtual PC access to your physical computer’s USB ports and other devices. It also means that you can move the virtual machine to a new PC should your current computer need replacing.
Here’s everything you need to know about installing Windows in a virtual machine on Linux with Oracle VirtualBox.
What You’ll Need for a Windows Virtual Machine on Linux
To get started, you’ll need the following things:
Now, the first two things are easy for you to get. It’s rare to own a PC without a Windows license, even when you’re running Linux, but you’ll need one that has virtualization.
How to Enable Virtualization on Linux
To check if your Linux PC supports virtualization, open a terminal prompt and enter
This command reveals everything you need to know about your system’s CPU, such as model, architecture, caches, and virtualization technology.
In this example, the HP laptop has Intel VT-x virtualization.
Virtualization, if not enabled by default, can be switched on in the system BIOS. The path to doing this will depend on the hardware you’re using. For the best results, boot into your system BIOS and look for references to Intel VT (on an Intel architecture PC) or AMD-V (on a PC with AMD CPU and motherboard).
This video explains what you should be looking for:
With regard to system RAM, while you might get away with some virtualization on old operating systems with 4GB, you should be starting with 8GB for the best results. The laptop used for testing this guide has 12GB RAM.
Choosing Virtualization Software
While QEMU is arguably the superior virtual machine option for Linux systems, we want a solution that can run Windows with a minimum of fuss and can be installed quickly. As such, for this tutorial we’ll be using Oracle VirtualBox.
Install VirtualBox in the command line. For Debian-based systems:
sudo apt install virtualbox
For RHEL-based distros (Fedora, CentOS) use:
sudo dnf install virtualbox
If you’re using Arch Linux or any similar distro, enter:
sudo pacman -S virtualbox
Wait while VirtualBox installs. If you prefer to, you can alternatively download the installer from Oracle. Our guide on how to install Oracle VirtualBox explains this in more detail.
Set Up Windows in Oracle VirtualBox
With VirtualBox installed on your Linux PC, launch the software.
Oracle VirtualBox can be used to run any modern version of Windows. This guide is suitable for anyone who wants to install Windows 10 or 11, but it should also work for Windows XP, Vista, 7, or 8.1. (Some settings may differ, but all will run.)
Start by clicking New, then give the virtual device a name. In the Type drop-down menu ensure that Windows is selected, and in Version, the correct Windows version. You can run pretty much anything from Windows 3.1 to date.
Click Next to continue, and in the subsequent screen, select the Memory size for the virtual machine. A default recommended size will be suggested based on the OS you chose and the hardware of your physical computer.
Click Next to create your virtual hard disk drive, again choosing the default option unless you have a particularly large amount of data to run in the VM.
Once done, hit Create, then select your preferred file type. If you’re just going to use the virtual hard disk with VirtualBox, hit Next, otherwise choose a different format as appropriate. You must then specify whether the virtual HDD should be dynamically allocated (i.e. it increases in size as required, to the pre-selected upper limit) or a fixed size. In most cases, you’ll want dynamic.
Click Next to continue, confirm (or change) the file name, location and size, then Create again to continue.
Installing Windows on Linux
With the virtual machine configured — think of it as building a PC but with virtual components — you’re now ready to install Windows. If you’re using a disc or a USB stick to deliver the ISO, now is the time to insert the media holding the ISO file.
Now, click the green Start arrow, and select the location of the source data — the Windows installer disc. Click Start, then wait as the virtual computer loads the Windows setup.
If you’ve installed Windows before, you should be familiar with this — if not, the wizard will help you through the process.
How to Install a Windows 10 VM on Linux Without the Disk
If you’re a developer, and you’re looking for a way to install Windows 10 briefly for testing purposes, all of the above may seem like a bit of effort.
Fortunately, there is a solution, provided by Microsoft. Virtual machines of Windows 7 through to Windows 10 are provided (with 90 day expiry) in the Microsoft Edge Developer portal. A VM from here can be easily downloaded and deployed in VirtualBox.
- Head to Microsoft Edge Developer portal’s Virtual Machines page
- Under Virtual Machines, select the OS that suits your purpose (choose from Windows 7, 8.1, and 10)
- Under Choose a VM plarform, select VirtualBox
- Click Download.zip
- Once downloaded, extract the downloaded file
- Open Oracle VirtualBox
- Select File > Import Appliance
- In the Import Virtual Appliance screen, browse for the extracted Download.zip file
- Click Next
- Confirm the details of the VM and the suggested settings, making any changes you think necessary
- Click Import to proceed (the duration of the import will depend on your system RAM and the speed of your HDD or SSD)
- Once complete, select the new virtual machine and click Start.
To log in to the Windows VM, use the default username/password of IEUser/Passw0rd!
As mentioned earlier, it is worth creating a snapshot of the virtual machine after set up to make it easy to roll back to if something goes wrong.
One thing to note: you may need to tweak your virtual machine settings for this to work correctly. Microsoft’s own guidelines state you should use the following RAM amounts:
- Windows XP images: 256 – 512MB
- Windows Vista images: 512 – 1024MB
- Windows 7 images: 1024 – 2048MB
- Windows 8 images: 1024 – 2048MB
- Windows 10 images: 1024 – 2048MB
So, if your downloaded virtual machine image doesn’t work as expected, adjust the RAM as outlined. As a rule of thumb, err towards the maximum rather than the minimum RAM.
Launch Windows and Install Software!
If you’ve made it this far, you’re done. You should be able to boot into Windows and install software, either via DVD (thanks to the VirtualBox tools) or by downloading and installing.
All of your usual Windows applications should run as normal, restricted only by the hardware of your host computer — the physical PC onto which you installed VirtualBox. Using a virtual machine is probably the best way to get Windows apps and games if Bottles and Wine don’t work for you.
Having a Windows VM that you can easily switch on and off at your convenience, while continuing with your daily Linux computing, is a massive advantage. If you need to run Windows software and have the hardware to support virtualization, then this is a great solution.