How to Create a Linux Hyper-V Virtual Machine in Windows 8

Although best when running Windows guests, Windows 8 built-in Microsoft Hyper-V can also be used to run Linux guests. Officially Hyper-V only supports SUSE and Red Hat enterprise server distributions but with a few simple tricks any Linux distro can be installed.
In this tutorial we will install both OpenSUSE 12.1 and Ubuntu 11.10 distros. Please notice that I have still not found how to get sound working on Hyper-V Linux guests. Also changing the resolution seems to be extremely tricky, following this tutorial you can set OpenSUSE display resolution freely during the installation procedure but it cannot be changed later on. For Ubuntu I have only managed 800 * 600 resolution.
Forgetting the missing sound and restricted resolution, Hyper-V Linux guests are fully functional operating systems, ideal for getting to know and practise Linux and virtualization.
Tips from other users regarding sound and resolution issues welcome!
In this tutorial we will install both OpenSUSE 12.1 and Ubuntu 11.10 distros. Please notice that I have still not found how to get sound working on Hyper-V Linux guests. Also changing the resolution seems to be extremely tricky, following this tutorial you can set OpenSUSE display resolution freely during the installation procedure but it cannot be changed later on. For Ubuntu I have only managed 800 * 600 resolution.
Forgetting the missing sound and restricted resolution, Hyper-V Linux guests are fully functional operating systems, ideal for getting to know and practise Linux and virtualization.
Tips from other users regarding sound and resolution issues welcome!
For this tutorial you need:
- OpenSUSE install media (software.opensuse.org: Download openSUSE 12.1)
- Ubuntu install media (Download | Ubuntu)
- Hyper-V enabled (see Hyper-V - How to Use in Windows 8 on how to enable Hyper-V, create external network switch and install Windows guests)
1.1. Create a virtual private network switch
For a Linux guest to work on Hyper-V it needs to use so called Legacy Network Adapter, a private one while installing and an internal or external one when running. Before installing OpenSUSE we need to create a private network switch using Legacy Network Adapter.
- Open Hyper-V Virtual Switch Manager
.
. - Click New virtual network switch
- Select Private
- Click Create Virtual Switch
.
. - Give your Virtual Switch a name, select Private Network, click OK to apply and save settings
.
.
- Click New on Actions pane on Hyper-V Manager, select Virtual Machine
.
. - New Virtual Machine Wizard opens. Click Next
.
. - Specify the name of the virtual machine and where it should be saved. Click Next
.
. - Assign RAM. Notice that the RAM assigned to a virtual machine is taken from the total of RAM on your host PC; to run virtual machine well you need to balance between the RAM of your host and virtual machine. For OpenSUSE I recommend using 1 GB (1024 MB); if less you can have issues with GUI, more does not add speed or benefit in other way. OpenSUSE runs well with 1 GB. Click Next
.
. - In Network Configuration at this point select Connection: Not Connected. We will add virtual switch later
.
. - Specify name, location and size of the virtual hard disk. For OpenSUSE 8 GB is enough to install and run, here I added some more for storage space. Click Next
.
. - Specify the location of install media, an ISO file or CD/DVD. Click Next
.
. - Click Finish
.
- Open your vm settings
.
. - Remove Network Adapter. This needs to be done for Legacy Network Adapter to work
.
. - Click Add Hardware, select Legacy Network Adapter, click Add
.
. - Set Legacy Network Adapter to use the Private switch you created earlier
.
. - Click Apply, click OK
1.4. Install OpenSUSE- Select your OpenSUSE vm on Virtual Machines list, click Connect
.
. - Click Start to start vm
.
. - Press F3 to select resolution. Notice that as I mentioned earlier I have still not found how to change resolution later so this selection now determines what resolution your OpenSUSE vm is going to use
.
. - Select Installation and press Enter
.
. - Select your preferred language and keyboard layout. OpenSUSE will be installed on the language you select here, using selected keyboard layout. Click Next
.
. - 6. Click Next
.
. - Select your Time Zone, click Next
.
. - Select KDE desktop, click Next. In my tests the Gnome desktop has refused to work
.
. - Click Next
.
. - Enter your user credentials, click Next
.
. - Click Install, confirm by clicking Install again
.
. - After Installation is done OpenSUSE reboots by itself. Select Boot from Hard Disk after reboot
.
. - Select Desktop – - OpenSUSE
.
. - OpenSUSE makes last configurations and boots to KDE desktop. Shut down vm as soon as you enter the desktop
.
. - Open OpenSUSE settings, set Legacy Network Adapter to use an external switch. See Hyper-V - How to Use in Windows 8 to see how to create an external switch
.
. - Start OpenSUSE vm, log in and you are ready to go
.
2. Install Ubuntu 11.10 guest on Hyper-VFor how to create a private virtual switch, create Ubuntu virtual machine and add Private Legacy Network Adapter and making Ubuntu installation to use it, follow the steps 1.1., 1.2. and 1.3. as described above (Install OpenSUSE on Hyper-V).
2.1. Install Ubuntu
- Connect and start vm as described above (Install OpenSUSE) on 1.4.1 and 1.4.2
- For Ubuntu (and all Debian family distros) to work on Hyper-V we need to disable Advanced Configuration and Power Interface (ACPI). When ACPI is enabled, Ubuntu does not support Legacy Network Driver needed to install and run it on Hyper-V. Press F6 to select installation options, select acpi=off, press Spacebar to select it, press ESC to exit Options menu
.
. - Select Install Ubuntu, press Enter
- Select the installation language
.
. - Select Install this third party software to add MPEG support, click Continue
.
. - Select Erase and Install, click Continue
.
. - Click Install Now
.
. - Select your Time Zone, click Continue
.
. - 8. Select your preferred keyboard layout, click Continue
.
. - Set your user credentials
.
. - Let Ubuntu install
.
. - When installation is completed click Restart Now
.
. - When Ubuntu reboots and stops telling Please remove installation media, click Stop to stop and close vm. This ejects the installation media
.
. - Restart vm, log in
.
. - Click an empty spot on desktop, press CTRL+ALT+t to open Terminal (about the same as Command Prompt in Windows). To move to Root (about the same as in Windows an elevated Command Prompt), type sudo –i and press Enter. Enter your password to confirm, press Enter again
.
. - Now we need to edit Initramfs to add modules which offer support for Hyper-V integration components. We need to manually add modules for bus (= traffic between host and guest), storage and network. To do this, open Initramfs using your preferred editor. I use Nano in this example:
- Type nano /etc/initramfs-tools/modules and hit Enter to open Initramfs in Nano editor
.
. - Add these four lines at the end of the file
hv_vmbus
hv_storvsc
hv_blkvsc
hv_netvsc
.
. - Press CTRL+X to end editing, press Y to save changes. Press Enter to finally accept old Initramfs to be overwritten
.
. - Update Initramfs: type update-initramfs –u, press Enter
.
. - Type exit and press Enter to exit root (admin mode), type exit and press Enter to close Terminal
.
. - Shut down vm
- See step 1.4.15. (Install OpenSUSE) above to switch Legacy Network Adapter to External Switch
- Start vm, login and you are ready to go
.
.
Please feel free to comment and suggest changes!
Kari
Related Tutorials
- How to Create a Virtual Machine with Windows 8 Hyper-V
- How to Create a Hyper-V "Remote File Browser" Shortcut in Windows 8
- How to Create a Hyper-V Manager Shortcut in Windows 8 and 8.1
- How to Add or Remove "Hyper-V Manager" to Control Panel in Windows 8
- How to Change Default Virtual Hard Disk Location in Hyper-V
- How to Convert Hyper-V Virtual Hard Disk to VHD or VHDX
- How to Enable and Disable Hyper-V in Windows 8 and 8.1
- How to Turn On or Off Hyper-V Enhanced Session Mode in Windows 8.1
- How to Export and Import a Hyper-V Virtual Machine in Windows 8 and 8.1
Attachments
-
Hyper-V_external_network_switch.PNG38.9 KB · Views: 426
-
Install_OpenSUSE_on_Hyper-V_008.png20.2 KB · Views: 430
-
Install_OpenSUSE_on_Hyper-V_009.png20.4 KB · Views: 391
-
Install_OpenSUSE_on_Hyper-V_024.png181.8 KB · Views: 359
-
Install_OpenSUSE_on_Hyper-V_bootGUI_not_shown.png16.8 KB · Views: 399
-
Hyper-V.png15.9 KB · Views: 389
Last edited by a moderator: