This week, Microsoft wrote some low-key news on its Windows 10 'beta' blog detailing an exciting change to Windows:
Today, we’re excited to announce that Canonical’s Ubuntu Linux Distro is now available in the Windows Store and can be downloaded and installed on any Windows Insider build.
Yes, hell has frozen over and Ubuntu has come to the Windows 10 Store! Behold, this impressive sight that almost nobody could have predicted a few years ago:
Yes, the year of Linux on the desktop (of Windows) is finally here. Yes, it was technically already here, but this change signals something new altogether.
This is a big departure from Microsoft's previous go at including Linux as part of Windows. For the last year, you've been able to turn on the Windows Subsystem for Linux in your settings, which would conjure a Ubuntu Bash shell that you can use.
I've written about that at length, and use it almost daily — but the change this week takes it to the next level, and paves the way for even more Linux distributions to come onboard.
The idea behind this move is that the Linux distributions are now containerized on your machine, and you can run as many as you like side-by-side. Need Fedora and Ubuntu? You got it!
Now when you install a distribution, like Ubuntu, you'll get a start menu tile to launch it directly — and a new command in your path `ubuntu` to jump straight into that shell.
Each distribution appears to be installed into a read-only AppX container, stored somewhere like
C:\Users\hi\AppData\Local\Microsoft\WindowsApps\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\Ubuntu.exe — but it can't just be launched by any process, and you'll receive a permissions error.
The bad news is the old way of using Ubuntu/Bash (Microsoft needs to settle on a better naming scheme for this) is now considered 'legacy' and you should migrate away from it. The good news is it's pretty easy.
First, install Ubuntu from the Windows 10 store (if you're on insider build 16215 or higher by heading here. Once that's done, open a command line and type `ubuntu` to get it set up for the first time — it'll take a few minutes to install.
Once you're done, I suggest copying all your config from your old
bash instance to your new `ubuntu` one, then deleting it. I just ran
cp -r ~/. /mnt/c/WSL then repeated that in reverse to get all my dotfiles and other stuff across to the new instance.
Now comes the key part — you need to tell Windows that your default Bash shell is the fancy new one. A handy tool, pointed out to me by Rich on the command line team at Microsoft exists for this:
I listed out my installed flavors of Linux by running
wslconfig /l then ran
wslconfig.exe /setdefault ubuntu to configure which instance should be launched when the Bash command is run.
The reason this matters is you'll never be able to run the Ubuntu command in other apps directly — I use the lovely Hyperterm emulator, and it would crash if I tried to launch
ubuntu.exe directly, but by changing the default underlying Linux magic, I didn't need to change any settings.
This is a pretty impressive move for Microsoft, and shows real commitment to making the life of developers who are switching to Windows better. Being able to run a number of Linux instances side-by-side is awesome, but now they're disposable and can be recycled in a matter of minutes.
More of my developer friends are jumping across lately, and frankly, life is better than ever in Windows-land now if you're coding for the web.
It's been about six months since I switched, and while it took a little getting used to, having a full Ubuntu box at my disposal, inside Windows 10, is a setup I couldn't have ever imagined being this good.
In case you want to read more, here's my post on getting your development workflow setup on Windows if you're coming from Mac.