In this blog post, we will learn how to install the Linux Ubuntu desktop operating system in Hyper-V on Windows.
If you are running a Windows 10 or 11 operating system and want to install the Ubuntu desktop operating system for daily use, testing, or educational purposes, then you can enable Hyper-V on Windows, and inside Hyper-V you can create a virtual machine and install Ubuntu on that virtual machine.
Before installing Ubuntu on Hyper-V, you should meet the following prerequisites.
1. First and foremost, ensure that Hyper-V is enabled in the Windows operating system by going to Program and Features > Turn Windows Features On or Off. If you don’t know how to enable Hyper-V in Windows 10, then follow the steps mentioned in the below link.
2. Your hardware must support virtualization in the BIOS; otherwise, you won’t be able to install Linux or Ubuntu on Hyper-V.
3. You must have a good internet connection if you are creating virtual machines, downloading, and installing Ubuntu on Hyper-V by using the quick create method automatically.
4. You need to download the Linux Ubuntu desktop ISO image file from the official ubuntu.com website if you are planning to create a virtual machine and install Ubuntu manually.
Create a Virtual Switch
Create a virtual switch in Hyper-V for Ubuntu. Otherwise, you won’t be able to install Ubuntu. Let’s see how to create a virtual switch in Hyper-V.
How to create a virtual switch in Hyper-V for Ubuntu
1. Type Hyper-V in search and click “Hyper-V Manager.”
2. The Hyper-V Manager window will open as shown in the below image.
3. Click “Action” then “Virtual Switch Manager“.
4. Click “New Virtual Network Switch“, then choose “External” as the virtual switch type, and then click “Create Virtual Switch“.
5. Enter the Virtual Switch Name and under connection type, make sure “External network” adapter is selected, click Apply and OK.
6. Click Yes; it may disrupt network connectivity.
A virtual network switch has been created, and Hyper-V is ready to install Ubuntu.
Install Linux Ubuntu in Hyper-V
Let’s see how to create a virtual machine and install Ubuntu on it.
There are two methods for creating virtual machines that Hyper-V offers.
1. The first method is by using the Quick Create option, which allows you to automatically download and install the operating system and install it on the virtual machine.
2. The second method is that you can download the Linux Ubuntu ISO image file, create a new virtual machine, and then install an operating system manually.
Quick Create Setup
Let’s see how to install Ubuntu by using the quick create method.
1. In search, type “Hyper-V” and open the Hyper-V Quick Create app.
2. On the left pane, select the latest Ubuntu 22.04 LTS from the list of operating systems. At the time of posting this blog, the latest Ubuntu version was 22.04 LTS.
Then click “Create Virtual Machine” to start the downloading process from the Ubuntu official website. After the downloading process is complete, the virtual machine will be created automatically.
3. After the virtual machine is created, you can right-click the virtual machine and click “Connect” and follow the Ubuntu installation instructions.
Let’s see how to install Ubuntu by using the manual method.
1. Click Start and type Hyper-V in search and open “Hyper-V Manager“. Then click “Action” > “New“ > “Virtual Machine.”
2. Click “Next“.
3. Enter the virtual machine name. The default location for the virtual machine is C:\ProgramData\Microsoft\Windows\Hyper-V. You can change the location if your computer’s C: Drive doesn’t have enough space and click “Next.”
4. Choose the generation for your virtual machine. If you want your virtual machine to support 32-bit and 64-bit guest operating systems, then select “Generation 1” or you can select “Generation 2” if you want UEFI-based firmware that supports 64-bit guest operating systems, and then click “Next“.
5. Assign memory to your virtual machine. In the case of Ubuntu, it requires a minimum of 4GB of RAM. After assigning memory, click on “Next.”
6. Use the drop-down menu to select the virtual switch that you created earlier and click “Next.”
7. Assign the virtual hard disk size to a minimum of 25GB, which is Ubuntu’s minimum requirement, and then click on “Next“.
8. On the installation options screen, select “Install an operating system from a bootable CD/DVD-ROM” and choose “Image file (.iso)”. At the time of posting this blog, the latest Ubuntu version is 22.04 TLS, which we will install. Specify the path of the Ubuntu ISO file and click “Next“.
9. Review the virtual machine specifications and click on “Finish.”
Start a Virtual Machine and Install Ubuntu
1. Open Hyper-V Manager under virtual machines, right-click and click “Connect“.
2. Click “Start” to start the virtual machine.
3. Select Try or Install Ubuntu and press Enter.
4. The installation process started.
5. Choose your language and click “Install Ubuntu.” If you want to try Ubuntu before installing it, then click “Try Ubuntu.”
6. On the keyboard layout, choose your language keyboard and click “Continue“.
7. At Updates and other software, choose “Normal installation” and then click “Continue“.
8. On installation type, I am not creating a partition just going by default, so I will select “Erase disk and install Ubuntu”. If you want to create a partition, then choose something else, create a partition, and then click “Install Now“.
9. Click “Continue” and it will write the changes to the disks.
10. Choose your time zone and click “Continue“.
11. Provide your name, the computer’s name, a username, and a password, then click “Continue“.
12. Installation of Ubuntu will start.
13. Installation has been completed; click on “Restart Now” to start your computer.
14. Logon with your credentials.
15. At the live patch page, click “Next.”
16. If you want to send system info to Canonical, then select Yes or else No, and then click “Next.”
17. If you want to allow the application to track your geographical location, then enable location services, or better yet, leave them at their default disable settings, and then click “Next.”
18. At the ready to go page, click “Done.”
19. Ubuntu desktop screen.
Hyper-V on Windows allows you to create a virtual machine and install the Ubuntu desktop operating system on that virtual machine. It is a very good option to have if you want to test Ubuntu before using it on your laptop or desktop computer.