How to Run a Linux Desktop Using the Windows Subsystem for Linux
Whatsapp Pinterest
Advertisement

Running Linux alongside Windows has proven to be increasingly useful over the years. But dual-booting can be difficult to manage while setting up a virtual machine comes some stability issues.

One solution is to use the Windows Subsystem for Linux, but this comes without a desktop environment. So, why not just install the Linux distribution you own?

Here’s how to run a Linux desktop within Windows using the Windows Subsystem for Linux.

What Is the Windows Subsystem for Linux?

In case you were unaware, with the 2018 Fall Creators Update Windows 10 shipped with the Windows Subsystem for Linux. This is an optional feature that can be easily installed, which supports the installation of the Linux operating systems available in the Windows Store.

Install Linux on Windows

It basically means that you can open a Linux terminal in Windows and install and run Linux software.

No virtual machine is required and there is no dual booting.

The problem with Windows Subsystem for Linux, however, is that it is purely a command line experience. There is no desktop. For power users, this probably won’t be a problem, but as Linux has a wide selection of desktop environments, it does seem a bit of an oversight.

Fortunately, you can now install a Linux desktop in Windows, as long as you have first set up the Windows Subsystem for Linux.

Make Sure Windows 10 Is Compatible

Before proceeding, here’s the important bit: you need to be running a 64-bit version of Windows.

You can check this in Settings > System > About, where you’ll find the System type entry. To proceed, this should read “64-bit operating system”. If not, and you’re running 64-bit hardware, you’ll need to upgrade Windows 10 from 32-bit to 64-bit.

Check Windows version

Another prerequisite is that you need to be running Windows 10 build 14393 or later. You can check this in the same About screen, listed under Windows specifications. Look for the OS build—if it is higher than 14393, you can use the Windows Subsystem for Linux. If not, simply run a Windows Update.

Once Windows 10 is compatible, it’s time to follow our guide to installing the Windows Subsystem for Linux How to Get the Linux Bash Shell on Windows 10 How to Get the Linux Bash Shell on Windows 10 Need to use Linux no time to switch to a different PC or run a VM? Run Linux in Windows 10 with a Bash shell terminal instead! Read More .

With that set up, it’s time to add a desktop.

Install a Linux Desktop in Windows

If you have set up the Windows Subsystem for Linux already, click Start and enter bash. Click the first option (the bash run command) to start using Linux. The following steps assume you installed Ubuntu as your preferred Linux operating system.

Start by running an update and upgrading Ubuntu:

sudo apt update
sudo apt upgrade

While this upgrade is running, head to Sourceforge to download and install the VcXsrv Windows X Server utility. (Other X Servers are available for Windows, including Xming and MobaXterm. For the remainder of this guide, we’ll be using VcXsrv.)

An X server lets you access a Linux application or desktop environment’s graphic user interface (GUI). Linux systems rely on X for displaying the desktop, but it can also be used across a network.

Ensure your X window server is installed before proceeding. The next step is to install your Linux desktop.

Many Linux desktop environments (LDEs) are available. We’re going to keep things simple and install a lightweight environment called LXDE. To install, input:

sudo apt install lxde

Following installation of LXDE, input this command

export DISPLAY=:0
export LIBGL_ALWAYS_INDIRECT=1

This instructs Linux to display the desktop through the X server. So, when you run the X Server program you downloaded above, you’ll see the Linux desktop environment.

We used VcXsrv which features the XLaunch tool. Click this to view the X Display Settings window and select One large window or One large window without titlebar. Look for the Display number while you’re there and set it to 0.

Set up an X server in Windows

Click Next, then select Start no client to ensure the XLaunch starts only the server, allowing you to start the Linux desktop later. Click Next again, then Finish. You might first like to click Save configuration to save it.

Configure an X server in Windows

Ready to launch your Linux desktop? In the command line, enter the command to start your preferred LDE. For LXDE, for example, use:

startlxde

The Linux desktop environment should then appear!

Linux desktop in Windows

You can now run any of the preinstalled Linux software and even install new apps and utilities.

Don’t Want a Linux Desktop? Just Install an App

In addition to installing a Linux desktop, you can simply install a Linux desktop app from Windows 10. This is useful if you consider installing a full desktop for one to be overkill.

For example, to install the Rhythmbox media player and run it in Linux on Windows, use:

sudo apt install rhythmbox

Ensure that you have set the export command:

export DISPLAY=:0

Then simply run the app from the Bash prompt:

rhythmbox

The media player will launch, ready for you to browse for a library.

Run Linux apps in Windows with Windows Subsystem for Linux

Now, in this case, you would obviously need to add some media files into the Linux environment on your computer. You might do this by installing a browser and downloading files, or simply by hooking up a USB drive with media files on.

After connecting the USB drive, remember to mount it (this example uses D: as the drive letter):

sudo mount -t drvfs D: /mnt/d

When you’re done, you’ll need to unmount the drive before removal. This ensures the integrity of the data on the drive.

sudo umount /mnt/d

While it’s possible to browse your Windows folders from within the Linux apps, no actual files can be opened. This is a shortcoming of the Windows Subsystem for Linux, albeit one that protects both the Windows and Linux environments from damage.

Linux in Windows: The Ultimate Convergence!

The Windows Subsystem for Linux makes it simple to run Linux software on a Windows PC. There’s no need to worry about virtual machines or the pain of dual booting.

With a Linux desktop installed, the convergence is almost complete. It’s a great way to get to grips with Linux from the comfort of the Windows desktop.

Want to learn more? Here’s how to get started with Linux. And you might also enjoy checking out why Windows shipping the Linux kernel changes everything Why Windows Shipping the Linux Kernel Changes Everything Why Windows Shipping the Linux Kernel Changes Everything Want to run Linux in Windows? Thanks to the Windows Subsystem for Linux it's even easier. Here's why this is important. Read More .

Explore more about: Linux, Linux Desktop Environment, Linux Tips, .

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. mcswell
    October 29, 2019 at 2:03 am

    After following the instructions here, and trying to startlxde, I was getting the error msg
    Xlib: extension "RANDR" missing on display ":0".
    This I was able to fix using this cmd (from Stack Overflow, where else?: https://stackoverflow.com/questions/17944234/xlib-extension-randr-missing-on-display-21-trying-to-run-headless-googl):
    export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
    Of course that should be in your .bashrc

  2. Gilbert
    October 14, 2019 at 7:46 pm

    Used it with Kali Linux from windows store on my surface 3 tablet and worked. Thanks for the instructions.

  3. asheenlevrai
    October 7, 2019 at 8:56 am

    I followed the tutorial but installed Mate rather than Lxde as a DE for Ubuntu.
    In VcXsrv in need to check the box saying "disable access control" otherwise the DE would not launch (error message).

    Now I still get a whole lot of error messages when launching mate-session in ubuntu but the DE loads in VcXsrv and I get to the Mate desktop :)

    Best,
    -a-

  4. Tee
    August 7, 2019 at 4:42 pm

    The command "startlxde" is not recognized at either the Ubuntu command line nor the Windows Command Promt.
    I followed the directions of this article but got stuck.
    At the part "Ready to launch your Linux desktop? In the command line, enter the command to start your preferred LDE. For LXDE, for example, use:" which command line are you referring to, bash, cmd, something else?

  5. David
    July 10, 2019 at 10:32 pm

    I wanted to do this with GNOME but it doesn't seem to be working because there appears to be no such command as "startgnome"... Does anyone know how to accomplish this?

  6. Ned
    June 18, 2019 at 6:04 pm

    Make a KDE Plasma tutorial so we can run KDE Plasma on Windows 10 via WSL.

  7. Dragonclaw
    April 15, 2019 at 8:53 pm

    Or, run a distro in a virtual machine / or dual-boot config. The former being the easiest.

    • YouDidntRead it didyou?
      April 20, 2019 at 6:21 pm

      The whole point of this article was running a Linux Desktop and applications in a native Windows10 environment with Xming. Dual booting just opens up the door for problems down the road, and running hardware based VM's are taking away from your systems resources. Which are already being abused by the Windows operating system. The best way to run any application is in user space like docker and lxc , sharing the kernel so you dont have to allocate system resources to a VM. You can share the display manager with lxc and docker and run GUI based apps straight from a terminal based hypervisor. I access my WSL install straight from the regular old microsoft RDP app on localhost:3390 . I have Ubuntu and Kali, the Ubuntu is just a CLI with apps over X11 Forwarding, and Xming like this tutorial explains. Option B, My kali desktop runs over rdp on localhost:3390. I have a bash script that will set this up and start xrdp. Save it as script.sh , chmod +x script.sh , and then run it ./script.sh . Pop open RDP and connect to 127.0.0.1:3390 , type in user name/password & you're in business.
      Just make sure the xorg option is selected in the RDP app when you connect.
      #!/bin/bash
      apt-get update
      apt-get dist-upgrade -y --force-yes
      apt-get --yes --force-yes install kali-desktop-xfce xorg xrdp
      echo "[+] Configuring XRDP to listen on port 3390 (but not starting the service)..."
      sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini