If you plan to use Linux shell environment being forced to use Windows 10 Pro, Windows Subsystem for Linux is one of the best solutions nowadays. After several release cycles and patch fixes, it seems stable enough to satisfy several Linux admin requirements.
A main reason for me to use WSL is shared RAM. This way my computer can run the heavy Microsoft Office suite, OpenVPN, Microsoft Teams, huge load of tabs in Chrome, Slack, Rocket, … plus another 20 ssh connections and much more without running out of RAM.
Launching an Ubuntu environment is easily done via Microsoft Store following this instructions. But if you need multiple environments, you will keep crawling the Internet (or continue reading).
Luckily there is a solution – LxRunOffline – which provides options to install new and clone existing environments even with choosing the installation path.
This way, multiple Ubuntu installations will find a home for testing ansible sketches, separating environments for different projects and further more.
From this point, I always recommend using cmder. This is a nice tabbed-style terminal emulator (based on ConEmu) suite. One tab can run Powershell and other tabs are handling connections to WSL – or multiple WSL environments.
After installing LxRunOffline using chocolatey – an apt style installer for Windows – a boot is required.
A list of downloadable distribution WSL images can be found here: https://github.com/DDoSolitary/LxRunOffline/wiki
Download an image and store it for example in your download directory. Afterwards open a powershell session (or cmd). Running the command will output a few Warning messages about devices that can’t be created. It is safe to ignore them.
The “s” flag will create a shortcut on your desktop for this environment.
LxRunOffline.exe i -n ubuntu-1 -d C:\WSL\ubuntu-1 -f .\Downloads\16.04.2-server-cloudimg-amd64-root.tar.gz -s
After unpacking the image, check the result using the Windows builtin wslconfig tool which lists the newly created “ubuntu-1” installation.
λ wslconfig.exe /l
Windows Subsystem for Linux Distributions:
This post is just a short idea how you can use WSL for your needs. Don’t expect too much, but the performance has become better over the past months. Some last words to quickly ramp you up:
- The installed WSL environment can be launched using the shortcut on the desktop or from within cmder
- The Windows user directory is available from within the WSL environment: /mnt/c/. Unfortunately file permissions with Windows mounts are still an issue as files are mapped to 777.
- Never modify WSL files from your Windows environment – though a backup can be done. I use 7zip to backup home directories of WSL environments.
- Docker in WSL – that is not working, but vagrant is possible to use with a special WSL flag and if the Vagrantfile is stored in a Windows share (/mnt/c/…)
- To run Vagrant, a virtualbox installation is required on Windows