The real reason why Canonical and Microsoft brought Ubuntu to Windows 10 was to enable system administrators and developers to use Bash and other Linux shell programs, such as make, gawk and grep, on Windows. Linux users, being natural hackers, immediately started working on bringing Linux graphical desktops to Windows Subsystem for Linux (WSL).
This isn’t easy to do, and it’s a long way from being a complete Linux desktop, but it’s a start. If you want to run the Ubuntu Linux desktop in Windows 10 for work, I recommend you do it via a virtual machine (VM) program such as Oracle’s VirtualBox. But, if you just want to have fun and sharpen your desktop programming skills, you too can try running Ubuntu on Windows 10 natively.
To get started on this project today, you need to be running the beta Windows 10 Fast Ring release. With the public release of the Windows 10 Anniversary Update, everyone will be able to give it a try. So how to run the native Ubuntu desktop on Windows 10? Check out, below.
First you must turn on Windows 10’s Developer Mode via Settings > Update & security > For developers. Next, search for “Windows Features” and choose “Turn Windows features on or off” and enable Windows Subsystem for Linux (Beta).
After that, to install Bash, you must open the Windows Command Prompt and type “bash.” You’ll be asked to accept the terms of service and download Ubuntu. The typical Ubuntu download is a bit less than one gigabyte. So, if you have a slow internet connection, be ready to wait. Once installed, you’ll be running a userspace version of Ubuntu 14.04 on top of WSL.
Technically, you’re not running Linux. It may look like Linux and squeak like Tux, the Linux penguin; but it’s not Linux. That’s because the Ubuntu userspace is running not on a Linux kernel, but WSL. WSL provides the API hooks to look like Linux to Ubuntu and Linux applications, but it’s not the same thing. This will become important as we go along.
Once you have Ubuntu installed, you’ll need to update it. You do that from the Bash shell by running the following commands:
1. apt-get update
2. apt-get upgrade
Now, switch back to Windows 10 and install a Windows compatible Xserver. This is what Ubuntu uses to display a graphical interface. The best of these for our purposes are vcxsrv or Xming.
Next, you have to tell Ubuntu about the Xserver so it can use it. To do this you can enter the following command at the shell:
Now, any graphical Linux program will display on Windows 10. Better still, if you’re going to keep working with graphical Linux software on WSL, have WSL automatically ready itself for graphical programs by placing the command in Bash’s configuration file: “.bashrc”. An easy way to do this is to use the echo command to write it with the following shell command.
echo “export DISPLAY=:0.0” >> ~/.bashrc
After this, you can run graphical Linux programs, such as Firefox, or desktops… but they won’t run well or for long. That’s because WSL doesn’t include socket support. Sockets are what Unix and Linux use to communicate between services. On the Linux desktop, the default way to implement sockets is the D-Bus messaging system. Without D-Bus, many Linux desktop graphical programs don’t work that well, if, at all.
WSL does, however, support the TCP networking protocol and a Reddit user named ShaRose has found a way to make D-Bus use tcp in place of sockets. Perfect? No. But it works.
To enable this, run the following command:
sudo sed -i ‘s/<listen>.*<\/listen>/<listen>tcp:host=localhost,port=0<\/listen>/’ /etc/dbus-1/session.conf
This used the sed stream editor to change D-Bus’s configuration file so that from here on out it will use tcp instead of sockets. The end result? Applications that need D-Bus will now run on WSL.
In the next step, it’s time to install the graphical desktop programs. You do this by running these programs from Bash:
- apt-get install ubuntu-desktop
- apt-get install unity
- apt-get install compiz-core
- apt-get install compizconfig-settings-manager
The first command installs the basic Ubuntu desktop programs. This will include end-user programs such as LibreOffice, The next instruction installs the Unity desktop. The final two commands install, Compiz, an OpenGL graphics composting manager and its front-end ccsm. Your next step will be to use ccsm to set up the desktop’s settings.
After all these programs are installed, run ccsm from Bash. From the ccsm interface, you’ll need to enable the following Compiz plugins:
- Copy to texture
- Ubuntu Unity Plugin
- Compiz Library Toolbox
- Windows Management
- Move Window
- Place Windows
- Resize Window
- Snapping Windows
Now, to get this show on the road, close ccsm and bring up the Unity interface by running compiz from Bash.
In a minute or so you should have Unity up and running.
Now, don’t go into this with false expectations. It’s not going to run well. But, on my Windows 10 test system, an ASUS desktop with an third-generation i7 3770 processor, and 8GBs of RAM, it ran well enough that I’m sure someone will eventually find a way to get the Ubuntu desktop to run usefully on WSL.