Some tips for installing and running Ubuntu in Windows thanks to virtualization with Hyper-V and WSL. In April 2022, Canonical released Ubuntu 22.04 LTS, the latest version of the Linux distribution with long-term support: security updates are guaranteed until April 2032. As usual, on the project’s official site, you can find all the downloads of Ubuntu, including versions for desktops, servers, IoT devices and so on.
The traditional way to install Ubuntu is to download the updated ISO image, save it to a Rufus bootable USB stick or a Ventoy multi-boot external device and boot from this media after changing the BIOS configuration /UEFI (boot sequence must expect to boot from the USB drive). The Ubuntu ISO file allows you to try the operating system without installing it ( live mode ) or starting the actual setup.
Install And Run Ubuntu On Windows
Thanks to the many virtualization solutions that we have today, it is very easy to install and run Ubuntu on Windows.
Installing Ubuntu As A Virtual Machine In Windows
To install Ubuntu in Windows, you can use various virtualization solutions, but Microsoft Hyper-V is immediately usable by users of all Windows 10 and 11 editions. You can install Hyper-V in Windows 10 Home and Windows 11 Home with a trick. We suggest typing Hyper-V in the Windows 10 and 11 search box: if no results are offered, we suggest pressing Windows+Then typing, ticking the Hyper-V Optionalfeatures box and pressing OK to install the Microsoft virtualization solution.
To proceed with a quick installation of Ubuntu in Windows, you can write Hyper-V quick creation in the search box of the operating system, click on Local installation source, and remove the check mark from This virtual machine will run Windows (enable Windows Secure Boot), click Change installation source then specify the ISO file downloaded from the official Ubuntu site.
Before even clicking on Create a virtual machine, it is advisable to select Other options at the bottom right and then assign a name to the virtual machine being created (for example, UBUNTU 22.04 LTS ). You can leave Default Switch selected for the moment as the virtual
By clicking Create a virtual machine, the message Creation of the virtual machine completed will appear after a few seconds. By clicking on Change settings, you can intervene in the configuration of the virtual hardware used by the Ubuntu virtual machine (for example, the number of cores used, the memory temporarily allocated to the virtual machine, the network card used and so on). With a click on Connect and then on Start, the GNU GRUB menu will appear: choose to Try or Install Ubuntu by pressing Enter.
After the initial loading phase, you can click Install Ubuntu and install the operating system as you would on any physical machine. To make the Ubuntu installation in the virtual machine reachable from other systems connected to the local network, type Hyper-V management console in the Windows search box, select Virtual switch management in the right column, choose New virtual network switch, name it EXTthen opt for External Network.
At this point, by clicking on File, Settings in the Ubuntu virtual machine window and finally on Network Card, you can change Default Switch to EXT: in this way, the router or, in any case, the DHCP server used within the local network will assign a private IP address to the Ubuntu Linux machine (press OK to confirm). As a last step, press the Shutdown button in the toolbar of the Hyper-V virtual machine, then click Start again.
Using Samba, you can share resources on the Ubuntu machine and access them from Windows systems. Once Ubuntu is installed, by opening a Linux terminal window and then typing the following two commands, you will see how the router has assigned a local IP to the operating system:
- sudo apt install net-tools
In the example, the private IP was assigned to the Hyper-V virtual machine with Ubuntu 192.168.1.157: by typing the command ping 192.168.1.157from Windows, Linux and macOS systems connected in the local network, you will get a response from the virtual machine. It is important to remember that simply closing a Hyper-V virtual machine window does not shut it down: the virtual machine remains running, as can be verified from the Hyper-V Management Console. By right-clicking on its name, you can stop it, force it to shut down or create “checkpoints” to restore its configuration if necessary.
Install And Run Ubuntu In Windows With WSL
The faster alternative to using Ubuntu in Windows 10 and 11 is to click on the Microsoft Store icon and search for Ubuntu 22.04 with the appropriate box above. Clicking Get will take you to a graphical wizard after downloading Ubuntu to help you set up your root account. Typing Ubuntu 22.04 into the Windows search box can boot the WSL version of the Linux distribution.
In this case, however, you will not have a graphical interface but a window comparable to the traditional bash. Thanks to the WSLg component introduced in the latest versions of Windows 10 and Windows 11, it is still possible to install and run Linux programs in Windows with a graphical interface: by doing so, for example, they can be added to the Windows Start menu or displayed on the taskbar and on the desktop the Linux programs you use most often.
They will be loaded in a normal Windows window, and you can create real links. We have seen the main differences between WSL and Hyper-V in another article. Finally, Canonical offers the Multipass mode that lets you get and start an Ubuntu virtual machine with a single command. Multipass currently supports Virtualbox, which must already be installed in Windows 10 or 11, but it is also possible to use the same function on macOS and Linux. The approach involves using the command cloud-init, well known to those used to create Linux instances on public cloud services.