One of the many reasons to run Linux on Windows would be to get the best of both the worlds. There are several methods for running Linux on Windows. The authors recommend Linux Integration Services, which has been made available by Microsoft. Read on to learn how to use LIS
Recent releases from Microsoft—Windows Server 2012 R2 and System Center 2012 R2—come with the ability to effectively host Linux and associated open-source applications along with great management capabilities. Some of the improvements in Windows Server include faster live migration, dynamic memory support that can be used depending on workload, as well as the capability to dynamically resize VHDs and VHDXs. On the other hand, System Center provides a single interface for managing Windows, ESXi and Linux operating systems.
Microsoft’s new feature from Windows Server 2012 R2 and System Center 2012 R2, called Data Center Abstraction Layer (DAL), based on CIM and WS-Man standards, has common management abstracts for managing all the resources of a data centre (including the physical and virtual environments). To support DAL, Microsoft has contributed Open Management Infrastructure (OMI) along with other providers to effectively manage Linux. OMI is well known for its smaller disk footprint.
This article will tell you how to use Windows Server 2012 R2 Hyper-V and Windows Hyper-V Server 2012 R2, and why installing Linux Integration Services is a best practice while running Linux as a guest OS.
Different ways of running Linux on Windows
Linux can be run on Windows in the following ways.
Virtual machines. Virtual machines (VMs) are some of the best ways of running any operating system. The advantages of a VM include better hardware utilisation, the ability to run multiple OSs and to install and run any application. On a Windows machine, one can install third-party virtualisation software like Virtual Box, VMware Player or Windows Hyper-V. Note that one can’t install multiple virtualisation software on the same system.
The dual boot option. The dual boot option allows more than one operating system to reside on a single computer. In a dual boot, the Windows OS is stored on one volume/disk and the Linux OS on another volume/disk (assuming it is rarely used). The best use case would be to test a new OS without switching to it completely. This method is not the recommended way of running Linux alongside Windows, as the latter facilitates only partition-specific installation or on a logical partition (within an extended partition). The Microsoft recommendation is to install Windows on a primary partition.
Live USB and live CDs. A live USB is a USB Flash drive or USB external hard drive containing the full operating system. It is the preferred way of running Linux when compared to a live CD, as data contained in the booting device can be changed and additional data can be stored in the USB.
Installing Ubuntu via Wubi. Windows-based Ubuntu Installer (Wubi) is a software installer for Ubuntu. Wubi creates a special file on your Windows partition and uses that file as your Ubuntu drive without the need for a separate partition. This means that you can install Ubuntu and use it without any partitioning, and you can uninstall Ubuntu from the Windows Control Panel when your job is complete.
Cygwin. Cygwin is a collection of tools that offer a Linux-like shell environment on Windows, but it’s not a method of running a full Linux distro. Follow the link
https://x.cygwin.com/docs/ug/setup-cygwin-x-installing.html for download and installation instructions for Cygwin.
Installing Hyper-V role on Windows. To install Hyper-V role on Windows, you first need to take the following steps.
Preparing the hardware. Before you get started with enabling Hyper-V on Windows, make sure virtualisation technology is enabled via BIOS—> Processor Settings—>Virtualization technology.
Preparing the platform. In our example, let’s use Windows Server 2012 R2 Datacenter SKU on the host machine.
On Windows Server 2012 R2, go to Start, type Powershell ISE, and then type the following commands:
[stextbox id=”grey”]PS C:\Windows\system32> Import-
Module ServerManager
PS C:\Windows\system32> Get-Windows
Feature
PS C:\Windows\system32> Install-
WindowsFeature Hyper-V -Restart[/stextbox]
However, the best practice for running Linux on Windows is to use Linux Integration Services.
Linux Integration Services
Microsoft developers have built drivers for Linux OSs and have released them through a package called Linux Integration Services (LISs), which are synthetic drivers for the network and disk that enhance I/O and networking performance.
To ensure compliance with the Linux community, the drivers have been reviewed by community and forum members, and have been checked into the main Linux kernel code base. Linux distribution vendors can now pull the drivers from the main Linux kernel and incorporate them into their respective distributions.
Microsoft made LIS open source so that anyone can build from source and make changes to the code. The main Github page for Linux Integration Services is https://github.com/LIS and the latest LIS package is 3.5. The code (https://github.com/LIS/LIS3.5) for this has been released under the GNU Public Licence v2.
For more information on supported guest OSs on Windows OSs, please refer to the link
The following are some of the new features of LIS being introduced with Windows Server 2012 R2:
1. Kdump/Kexec. Just like physical machines running the Linux OS, Linux guests can also get crash dumps.
2. Dynamic memory. Based on the Linux guest OS’ needs, memory can be automatically increased or decreased.
3. Linux Synthetic Frame Buffer Drivers. It provides enhanced graphics performance for Linux desktop users.
You can refer to the following link for a detailed LIS feature list from Microsoft’s virtualisation blog. Click here
The following example will show you how to install LIS 3.5 for RHEL 6.3 running on Windows Server 2012 R2.
Installing Linux Integration Services (LIS)
1. Create a Generation One virtual machine and install RHEL 6.3. Download LIS from https://www.microsoft.com/en-us/download/details.aspx?id=41554
2. Connect to the virtual machine, and from the menu go to Media—>DVD Drive —>Insert Disk and attach LIS3.5 ISO.
3. Open a terminal in the virtual machine running RHEL 6.3, and run the following commands as the root user to mount the ISO and navigate to the directory relevant distribution (in this case, it is RHEL 6.3):
[stextbox id=”grey”][root@localhost ~]# mount /dev/cdrom
/media/
[root@localhost ~]# cd /media/
[root@localhost ~]# ls
[root@localhost ~]# cd RHEL63[/stextbox]
4. Locate the install.sh file, in our case /media/RHEL63/, and run install.sh as shown in Fig. 1. It should show the ‘Install successful’ message. To check whether LIS is installed properly, run the following commands from a terminal:
[stextbox id=”grey”][root@localhost ~]# /sbin/modinfo
hv_vmbus
[root@localhost ~]# /sbin/modinfo
hv_netvsc
[root@localhost ~]# /sbin/modinfo
hv_storvsc
[root@localhost ~]# /sbin/modinfo
hv_blkvsc
[root@localhost ~]# /sbin/modinfo
hv_util[/stextbox]
Fig. 2 shows the LIS version for ‘hv_vmbus’ after installing LIS 3.5.
Vinay and Avinash work as software development engineers at Dell India R&D Centre, Bengaluru. Vinay has close to two years’ experience in automation, Windows Server OS and is interested in virtualisation and cloud computing technologies. Avinash is interested in the automation and system management domains. This article is a reprint of their article in June issue of EFY’s Open Source For You magazine