3 good ways to run Linux on Windows
What's the biggest company in the world that supports the Linux desktop? Red Hat? No. SUSE? Close, but no cigar. Canonical? You're getting warmer. The answer? Microsoft.
At 2020's Microsoft Build, CEO Satya Nadella announced that Windows Subsystem for Linux (WSL) 2 would support Linux GUIs and applications. With this programmers can develop native and cross-platform programs with tools like GNOME Builder, KDevelop, and Visual Studio Code.
Nadella was good to his word. Starting with the recently released Windows 10 2004 Build 19041 or higher, you can run real Linux distributions, such as Debian, SUSE Linux Enterprise Server (SLES) 15 SP1, and Ubuntu 20.04 LTS. With any of these, you can run Linux and Windows GUI applications simultaneously on the same desktop screen.
Why would you want to do this? Simple: While Windows is the top desktop operating system, everywhere else it's Linux. If you are working in an organization that manages your systems and network, you probably get a Windows desktop to work on and are required to use Windows for many tasks. If you want to administer servers, use DevOps on the cloud, run supercomputer simulations, or develop programs for any platform other than Windows or the Apple ecosystem, you're working with Linux. Even on Microsoft's own Azure cloud, the most popular virtual machines (VMs) are Linux.
But, while Microsoft is now a full-fledged member of the Linux family, there are many ways to run Linux on Windows. Here are the best and the rest.
Old-school ways most people can ignore
You can still set up your computer to dual-boot Windows and Linux. I don't know why most folks would bother to do this today. With dual-boot, just like the name says, you're not running both operating systems at once. You're choosing to run one or the other. This may be handy if you're a Linux user who wants to run the occasional Windows-only game or application, but I'm hard-pressed to think of other use cases.
Cygwin is a Unix tool collection. With it, you can run a Linux-style shell on Windows. It will let you run some Linux shell programs, which have been recompiled for Cygwin on Windows. While somewhat useful, it was always a niche program, and its niche is even smaller today.
Another program that has largely outlived its usefulness is Wubi. This software enables you to install Ubuntu Linux on Windows 7, Vista, and Windows 10. Essentially, it lets you dual-boot Ubuntu, but instead of installing the operating system on your bare-metal hardware, it installs Ubuntu on a special file on your Windows partition, which it uses as your Linux drive.
Now, on to the best ways to run Linux with Windows.
Windows Subsystem for Linux (WSL) 1
If all you need is a Linux Bash shell and its associated commands—such as apt, ssh, find, grep, awk, sed, tar, vim, emacs, and diff—WSL 1 is all you need. You can also run popular open source programming languages such as Python, Perl, Ruby, PHP, and GCC. In addition, it supports server programs such as the Apache web server and MySQL database management system. It does this by translating Linux system calls into Windows calls and vice versa.
What you can't do easily is run a Linux GUI, such as GNOME, KDE, or Cinnamon. To do this with WSL 1, you have to run an X Window terminal in Windows. Even for hard-core Linux power users, that is a bit much.
So, why bother? There are several reasons. First, if you're working with a low-powered Windows 10 system, WSL 1 is ideal.
Rich Turner, Microsoft's senior program manager of WSL and Windows Console, says when it was introduced in the Windows Fall Creators Update in 2017, "we [didn't list RAM requirements] because, frankly, we don't have any of note! If you don't install WSL, we add no RAM footprint. If you do enable WSL, there's a tiny 850 KB driver loaded briefly, and then it shuts down until you start a Linux instance. … So, basically, WSL's RAM requirements are pretty much whatever the RAM is that you need to run each Linux binary, plus around 1MB of working set in total."
Another reason is that if all you need from Linux is shell programs, which is often the case for system administrators, then WSL 1 is, well, all you need.
Microsoft, which will continue to support WSL 1, also states that if your project files must be stored in the Windows file system, you'll get faster performance. In addition, if you must cross-compile the same files using both Windows and Linux tools, WSL 1 is, again, faster.
Windows Subsystem for Linux (WSL) 2
Unlike WSL 1, which relies on a translation level, WSL 2 comes with a full Linux kernel. The initial version of WSL 2 is based on the 4.19.81 long-term support Linux kernel. As Craig Loewen, Windows Developer Platform program manager, writes, "WSL 2 delivers full system call compatibility with a real Linux kernel and is [three to six times] faster compared to earlier versions of WSL."
WSL 2 and your preferred Linux distro runs, in turn, on your Windows 10 built-in Hyper-V hypervisor. Yes, this means WSL 2 is a VM approach at heart. But unlike other desktop VM programs, it's deeply integrated with Windows 10.
With WSL 2, Linux files are kept on a 256 GB virtual disk, formatted using the Linux-native ext4 file system. Linux file interactions are much faster—two to 20 times faster—when working with files on its native file system. WSL 2 uses the 9p file system protocol to support Windows access to Linux files and vice versa.
You can adjust the size of the virtual disk with each Linux distro. If you wish, and I suggest you do, you can also increase the available memory up from its default 2 GB to a more comfortable 4 GB.
Installing a specific supported Linux distro on WSL 2 takes just a few clicks and is almost as easy as installing any other Windows application. First, though, you must start by enabling Hyper-V and Virtual Machine Platform on your desktop. At one time, Hyper-V was available only on 64-bit Windows 10 Pro, Enterprise, and Education editions, but just enough of its functionality is now available on Home to run WSL 2.
That done, you're ready to go. The easiest way to get started is to use the Microsoft Store and pick your favorite Linux distribution. Currently, WSL 2 supports Ubuntu 16.04 LTS; Ubuntu 18.04 LTS; Ubuntu 20.04 LTS; openSUSE Leap 15.1; SUSE Linux Enterprise Server 12 SP5; SUSE Linux Enterprise Server 15 SP1; Kali Linux; Debian GNU/Linux; Fedora Remix for WSL; Pengwin; Pengwin Enterprise; and Alpine WSL
While graphical Linux desktop apps are supported, in this initial release of WSL 2, you must still jump through numerous hoops to get them to run. At this point, WSL 2 is still more for people who are comfortable with the shell interface rather than GNOME or other graphical desktops. By the end of the year, I expect you'll be able to run Linux graphical desktops easily on WSL 2.
For now, if you want the best possible Linux experience, you need to run your favorite Linux distro in a VM. The two most popular desktop VMs are VMware Workstation or Oracle VirtualBox. Besides running WSL 2, if you have a 64-bit Windows 10 Pro, Enterprise, or Education edition, you can also use Hyper-V to run Linux VMs. The Windows 10 Home Hyper-V variant isn't sufficient to easily set up and run ordinary VMs. You may run into performance problems on low-powered Home PCs with only 8 GB of RAM.
A VM can run any Linux on a sufficiently powerful PC. Generally speaking, any Windows 10 system with 16 GB of RAM should be able to run VMs. Even a Windows 10 Home PC with only 8 GB of memory can run VMs, but you may see performance problems on the Windows side.
The VM enables you to run a guest operating system on top of another operating system. From the guest's viewpoint, it appears to be running on its very own PC. It's actually running in a VM, which is a limited virtual sub-system of your PC.
With a VM, you can run a full Linux desktop with all the graphical goodies. Indeed, with a VM, you can run pretty much any operating system on Windows 10. For example, besides Linux, you can run Windows 7, Solaris, or even ArcaOS, a 21st century version of OS/2, in a VM.
VMs give you the widest possible operating systems choices. For example, Hyper-V, unlike WSL 2, enables you to run Red Hat Enterprise Linux (RHEL), CentOS, and FreeBSD.
Depending on your VM program, you can also work with both operating systems simultaneously. For example, with VirtualBox, you can copy and paste files between Linux and Windows 10 file systems.
The one problem with desktop VMs is that setting them up properly requires a lot of fine-tuning. Each hypervisor has its own configuration tools, and each operating system has its own requirements. For example, VirtualBox defaults to a 10 GB virtual disk for any Ubuntu-based Linux, but Linux Mint, which is Ubuntu-based, requires a minimum disk size of 12 GB. In my experience, you'll get the best results from maximizing VM system resources from one-third to half of your PC's total resources. If that proves to be too hard on your Windows 10 system's performance, you can also retune the VM's settings to a lower level.
Once set up, though, you should have no problems running Linux and Windows 10 simultaneously. I've been running Linux VMs on Windows since the days when Windows 2000 and VMware Workstation 2 were state of the art.
Which is best for you?
As always, the answer is "it depends." If all you need now is a Linux shell, WSL 1 is fine. But eventually, Microsoft will want you to move on to WSL 2, and WSL 2 is an excellent choice. It's improving rapidly, and you can expect by year's end that it will be able to run graphical Linux desktops without any real work. It's also the easiest Linux to set up at this time.
However, for a top-of-the-line simultaneous Linux and Windows 10 experience, you can't beat virtual machines. It's more work, but for now, VMs are also the most full-featured way to run Linux on Windows.
Whichever way you go, you can't go wrong. We're living in a golden age of Windows and Linux compatibility.
At a glance:
- WSL means that Windows users can run Linux and their desktops will be as manageable or almost as manageable as any other Windows desktop.
- Windows desktops with adequate memory resources, and perhaps extra monitors, are excellent productivity platforms for administrators and developers.
- How to see what's going on with your Linux system right now
- The first 5 things to do when your Linux server keels over
- The death of the command line
This article/content was written by the individual writer identified and does not necessarily reflect the view of Hewlett Packard Enterprise Company.