JamesGecko


Setting up Ubuntu on Windows 10

2016-10-05

You can run Ubuntu on Windows 10. It’s not running in a virtual machine. It’s magic. I’m going to set up my preferred environment. By the end of this document, I’ll have fish and Neovim running in tmux with 24-bit colors.

For ease of googling when you inevitably run into an issue, this feature is officially called the “Windows Subsystem for Linux,” or WSL for short. You may want to peruse the FAQ before getting started to douse your wild ambitions with cold water.

First, follow the Microsoft install documentation to get started, then come back.

Done? You now have bash running in a windows terminal. First things first. Your home directory lives in C:\Users\YOUR_WINDOWS_USER_NAME\AppData\Local\lxss\home\YOUR_LINUX_USER_NAME. If you open Windows Explorer and poke around in AppData\Local, you’re not going to see an lxss folder. That’s for a reason. Files in this folder have some extended attributes on them, and you can screw things up by poking at them in the Windows Explorer GUI. This is a command line only zone.

Now. Bash is OK, but I prefer fish. Scott Hanselman has a post about setting that up. I think Oh My Fish is a bit overkill, but whatever.

Let’s take this to the next level and use a half-decent terminal. Enter ConEmu. It has tabs and true color mode. You’re going to want the portable version.

You’ll want to set up fish as one of the default shells. ConEmu’s preferences are sprawling; you’ll want to add a new task here:

If you want true color mode, things get trickier. Check out the ConEmu WSL docs.

Basically, there’s a wsl directory bundled with ConEmu. Run the wsl-con.cmd command in there, and it’ll download a bunch of stuff into the directory (That’s why you’re using portable ConEmu). Then drop the wsl-con.bat and boot.sh scripts in and make a ConEmu task that points at them. Use /dir "c:\your\path\to\wsl\" in the task parameters field to set the working directory. I had to add the directory containing ConEmuC.exe to my Windows %path%. It’s not perfect; I get an extra tab that says ConEmuC: Root process was alive less than 10 sec, ExitCode=0 Press Enter or Esc to close console... every time I open a new fish tab.


Installing Neovim from the PPA works smoothly. No issues. This is hands down the best way to run Neovim on Windows.


Now I want Homebrew, but we’re going to have to settle with a lot of broken packages at this point.

james@JAMES-PC ~> sudo apt-get install build-essential curl git python-setuptools ruby
james@JAMES-PC ~> git clone https://github.com/Linuxbrew/brew.git ~/.linuxbrew

Don’t run the brew command yet! First, edit your ~/.config/fish/fish.config file

set -x PATH $HOME/.linuxbrew/bin $PATH
set -x MANPATH $HOME/.linuxbrew/share/man $MANPATH
set -x INFOPATH $HOME/.linuxbrew/share/info $INFOPATH
set -x HOMEBREW_BUILD_FROM_SOURCE true

Setting HOMEBREW_BUILD_FROM_SOURCE is pretty important! Otherwise you’re going to get issues involving Exec format error. On the downside, compiling everything takes forever. On the upside, brew will actually function! Kind of. Installing little tools like ag is good. Installing Neovim or fish from here is a no-go.

If you need to install anything that requires openssl, you’ll have to precompile openssl with a flag to avoid this bug.

james@JAMES-PC ~> brew install openssl --without-test

Don’t worry. I’m sure those failing tests we’re skipping aren’t ominous at all!

We’re like dogfort knox


I’m going to try to unify my config files across OS X, Fedora, and Windows because I am a madman. To detect Windows, I’m using the command cat /proc/sys/kernel/osrelease | grep Microsoft


Next stop, tmux. It’s preinstalled! An old version that doesn’t support true color mode. We need at least version 2.2 for pretty colors. How to you feel about PPAs from random people? Done!


Whew! There we are. A whole evening of work for something you could have set up in a tenth of the time using Ubuntu in a VM. But this is way more convenient that having to fire up VirtualBox, don’t you agree?

A parting screenshot of using this setup to edit some ancient code for posterity: Editing lyrical code

© 2021 JamesGecko