Elixir with Ubuntu on Windows

Bash on Ubuntu on Windows

Microsoft released the first iteration of "Bash on Ubuntu on Windows" today, so I decided to see what it would take to get Elixir up and running under this environment.

Overall, it turned out to be a fairly easy task, especially if you've worked with Ubuntu before. If you're interested in getting this up and running, follow these steps.

Getting bash installed

To get the option to install bash, you'll need to be a part of the Windows Insider Program. Once you are, head on over to Settings > Update & Security > Advanced Options and opt to receive 'insider builds'. Once this is enabled, you should be able to 'Check for updates' and see preview build 14316 available. Go ahead and install that build.

Additionally, you'll want to head on over to Settings > For developers and make sure you're on 'Developer mode'.

After you have the insider build installed and running, navigate to 'Windows Features' (just search for 'Windows Features' and click 'Turn Windows features on or off'). At the bottom of the list of features, you'll see 'Windows Subsystem for Linux (Beta)'. Go ahead and check that box, then click 'Ok'. The feature will be installed, and you'll be prompted to restart.

Once your machine has restarted and you're logged back in, do a search for 'bash'. You'll see a file called bash.exe appear, and you can execute it. This will kick off the download for Ubuntu on Windows. Once that installs, you'll be able to search for 'bash' again, and this time see an option labeled 'Bash on Ubuntu on Windows'.

First launch

The first time you launch your shell, you'll notice that you are dropped in as root. At this point, it is a good idea to go ahead and change your password by issuing the command passwd. Additionally, I went ahead and created a new user, and added that user to the sudo group:

useradd <your-username>  
# Follow prompts for adding user
usermod -aG sudo <your-username>  

Installing Elixir

Before installing Elixir, I switched over to my newly created user account, su <your-username>. At this point, I simply followed the installation instructions on the Elixir website and everything worked out perfectly.

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.deb

sudo apt-get update

sudo apt-get install esl-erlang

sudo apt-get install elixir  

After everything was downloaded and installed, I was able to drop into IEx successfully.

Wrap-up

Overall, it was pretty simple process to get bash up and running along with Elixir on Windows by using 'Ubuntu on Windows'. Now go on and play around with bash on Windows yourself!

As always, if you have any questions / comments, don't hesitate to drop me a line on twitter (@awgreenarrow), shoot me an e-mail at andrew@greenarrow.me, or write your own blog post and let me know about it via one of the first two methods!