Just like on Windows (and macOS), even on Linux you can create a virtual machine on which to install another operating system to use without affecting the real system. How do you get a list open ports on Linux?
To do this you can use VirtualBox, the famous free virtualization program that I talked about several times here on the blog. It is extremely easy to use and allows you to install any version of Windows on Ubuntu (or other Linux distro) in just a few clicks. If you want to learn how to install Windows on Linux using it, read on: find all the information you need right here below.
For the tutorial I used Ubuntu, to be precise, Ubuntu 18.04, but the indications in this article should be valid for all the main Linux distributions. As for the operation of VirtualBox, however, there are certainly no problems, because the software has the same interface on all systems and all platforms for which it is available. Without these necessary clarifications, I can only wish you a good read and have fun!
Preliminary operations
Before getting to the heart of the tutorial and finding out how to install Windows on Linux, you need to get an ISO image of Windows or a real installation disk of the Microsoft operating system.
The Redmond colossus allows you to download the ISO images of Windows 10, Windows 8.x and Windows 7 (the latter only after entering a valid product key and only for non-OEM system versions, then purchased separately and not pre-installed on computers), while Vista and XP are now obsolete and therefore are no longer available.
As easily understood, the ISO images of Windows are not 100% free: they can be downloaded and used at no cost, but need activation through a valid product key, just like the copies of Windows installed on “real” computers.
If you are interested, you must know that there are also Windows images prepared for use in virtual machines: they are image files of VirtualBox disks or other similar software that, once “fed” to the latter, allow you to use the Microsoft system without having to face any installation procedure.
Some of these images can be found directly on the Microsoft website, where images are available to test Internet Explorer and Edge (Microsoft’s browsers) on various versions of Windows. To download Windows images for VM from Microsoft, you must select the version of Windows you prefer more (e.g. MSEdge on Win10 for Windows 10) from the drop down menu Virtual machine, the program VirtualBox from the drop down menu Select platform and you have to click on the Download zip button that appears below. Pay attention to download a version of Windows (32 or 64 bit) compatible with the architecture of your Linux system.
Virtualize Windows on Linux
Once you have the Windows disk image, you can take action: the first step you need to take is to download VirtualBox. If you use Ubuntu, then start the integrated store (Ubuntu Software) by clicking on the shopping bag icon located in the sidebar of the desktop and search for “virtualbox” by clicking on the magnifying glass icon located at the top right typing the name of the program in the appropriate field that appears on the screen.
Once the search has been performed, click on the VirtualBox icon, then on the Install button, type the password of your user account on Ubuntu and press Enter to start the download and automatic installation of the program.
If you use a Linux distribution other than Ubuntu, you can download VirtualBox by connecting to the program’s website and clicking on the link related to the operating system you are using (e.g. Debian 9). There are two editions of the application, one 32-bit (i386) and one 64-bit (AMD64): choose the one that best suits your computer and the operating system you are using.
Download is complete open, double clicking on it, the file you just downloaded (e.g. virtualbox- [version] -Ubuntu-bionic_amd64.deb) and, in the window that opens, click on the Install button to install the VirtualBox on your PC. Once this is done, you can move on to creating the virtual machine on which to install Windows.
To install Windows on Linux with VirtualBox, start the program by looking it in the main menu of your distro (on Ubuntu you open by clicking on the icon with the 9 white dots located at the bottom of the left sidebar), then click on the New present button in its main window (top left).
Enter, then, the name you want to assign to the virtual machine with Windows in the text field, select the OS version you want to install from the drop down menu version and click Next to adjust the settings for the RAM to devote to virtual machine. Leave everything as it is, if you do not have special needs, and click on the Next button.
Now choose what type of hard drive to equip the virtual machine by setting its format, the type of allocation it must have and its capacity. I advise you to leave all the default options active: Create a new virtual hard disk, VDI and Allocated dynamically. In this way, you will get a hard disk in VDI format (the VirtualBox format) with a capacity optimized for the operating system to be installed in it and a type of dynamic allocation, which will occupy space on the PC hard disk (the real one) only when necessary.
Finally, it indicates the maximum space that must occupy the hard disk of the virtual machine on the computer disk and click on the Create button to end the procedure and get your virtual machine.
Now you have a virtual machine on which to “run” Windows, but you have not yet installed the operating system in it. To do this, you have two options available to you: use the Windows installation disk or an ISO image of the latter.
Whatever your choice, double-click the name of the virtual machine you just created on the main VirtualBox screen. In the window that opens, if you want to use an ISO image of Windows, click on the yellow folder icon and select the file in question. If, however, you are going to use a real disk to install the operating system, expand the drop down menu located in the middle of the window and select the drive of the DVD player. When the operation is complete, click on the Start button.
Now you just have to complete the Windows installation procedure normally, as if you were doing it on a real PC and not in a virtual machine.
After completing the installation of Windows, I suggest you to install the Guest Additions, additional drivers that allow you to increase the level of integration between the virtual system (Windows) and the main system (Linux) to connect the two environments, allowing example sharing the clipboard and data and better displaying the graphic contents.
To proceed with the installation of the Guest Additions, a virtual machine started, go to the Devices menu > Insert the image of the Guest Additions CD …(top) and, in the window of the autorun that appears in Windows, choose to start the executable. If you are asked to download the Guest Additions from the Internet, accept by clicking on the Download button.
Press, then, always on Next and, at the end of the setup, accept to restart the system. If you do not see any window of the autorun, open the Windows FileExplorer, select the item Computer / This PC from the left sidebar, select the virtual unit of the Guest Additions and proceed to the manual start of the installation of the latter.
Import an existing image
Have you downloaded a Windows image file ready for use in the virtual machine? Perfect: then, instead of creating a new virtual machine within the program, select the Import virtual application item from the File menu (top left), then click on the yellow folder icon , select the OVF image file in your possession, presses the buttons Next and Import and you’re done. You will find yourself a virtual machine ready for use on the main VirtualBox screen.
Alternatively, if you have downloaded a disk image in VDI, VHD or VMDK format (then an image of the virtual machine disk and not the virtual machine itself), you must create a new virtual machine, when you get to the disk creation step, you need to select the Use an existing virtual disk file option.
Then you have to click on the yellow folder icon that appears below, you have to select the image file you downloaded from the Internet and you have to confirm your choice by clicking on the Create button. You will then get your virtual machine with Windows ready for use.
Install Windows and Linux in dual-boot
If you want to install Windows on Linux in the sense that you want to create a real dual boot system in which to choose, every time you turn on your PC, which operating system to run between Windows and Linux, you must partition the disk to create a partition to be allocated to Windows. Then you need to boot from the installation disk of the Microsoft operating system and you must install a new copy of the latter on the partition created previously.
If you have already created a dual boot system by installing Linux on Windows but, when you turn on your PC, you are not asked which operating system to run, you should be able to solve the problem by restoring GRUB.