How to install Windows Subsystem for Linux (BashOnWindows) offline on Windows
- HTTP Web server (Apache/Nginx/Any other)
- trusty-server-cloudimg-amd64-root.tar.gz – Official Ubuntu 14.04 image provided by Microsoft
- trusty-server-cloudimg-amd64-root.tar.gz – Daily Ubuntu 14.04 builds provided by Canonical
- xenial-server-cloudimg-amd64-root.tar.gz – Daily Ubuntu 16.04 builds provided by Canonical
- First enable Windows Subsystem for Linux from “Program and Features” -> “Turn Windows features on or off”
- Restart Windows (MS has a thing for rebooting)
- Download one of the image and host it on your local web server if not done already
- Start Fiddler and enable “Automatic Breakpoints” (Alt+F11)
- Start command prompt and run “lxrun /install /y”
- Switch to Fiddler. You will see a request to “https://go.microsoft.com/fwlink/?LinkID=730581”. Click on “Headers” tab -> Right click on “Location” -> “Edit Header” -> Paste your local link URL (i.e. http://localhost/xenial-server-cloudimg-amd64-root.tar.gz) and click on Save -> Run to Completion
- There will be another request to “http://localhost/xenial-server-cloudimg-amd64-root.tar.gz”. Just click on “Run to completion” this time.
- After some time, there will again another request to download “ubuntu.ico”. Just allow it.
- Create a new user and you are ready to go!
Note for Ubuntu 16.04 users:
There is an issue with “sudo” command in Ubuntu 16.04 build. You will get sudo: no tty present and no askpass program specified. There are two simple possible solutions that I am aware of to fix it.
- Use “sudo -S” each time. Execute
echo $'\n'"alias sudo='sudo -S'" >> ~/.bashrcto create a permanent alias for it
- Set the default user as root. Execute “LxRun.exe /setdefaultuser root” in command prompt to do that