Is there a way of installing Ubuntu (Windows Subsystem for Linux) on Win10 (v1709) without using the Store?
Info: I tried this on a VM with Win10 Pro (v1709 & 1803) with stock Group Policy (i.e. as-is with a fresh installation).
That is: turning the Store off in gpedit.msc
did not make a difference...
According to Microsoft's "Windows Server Installation Guide":
Note that this answer shows the steps for Debian only. However, everything is the same for Ubuntu, SLES, openSUSE, and Kali - the only difference will be in the name of the EXE (and the URL you use).
Activate
Windows Subsystem for Linux
.- Via the
Windows Features
GUI: e.g. Win + I -->OptionalFeatures.exe
- With PowerShell (as administrator):
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
.
- Via the
Download the Linux-package.
- Choose your distro. Simply use one of these URLs:
- Debian:
https://aka.ms/wsl-debian-gnulinux
- Ubuntu 18.04:
https://aka.ms/wsl-ubuntu-1804
- Ubuntu 16.04:
https://aka.ms/wsl-ubuntu-1604
- openSUSE:
https://aka.ms/wsl-opensuse-42
- SLES:
https://aka.ms/wsl-sles-12
- Kali:
https://aka.ms/wsl-kali-linux
- Debian:
- Via PowerShell, run
Invoke-WebRequest -Uri https://aka.ms/wsl-debian-gnulinux -OutFile ~/Debian.zip -UseBasicParsing
.- If you do not need the progress-bar, add
$ProgressPreference = 'SilentlyContinue';
in the front of the command. - Note that
~/Debian.zip
can be changed to whatever path and name you want.
- If you do not need the progress-bar, add
- You can also download it "per manus" - feed the URL into your browser (or download manager) and you can get it this way, too.
- Choose your distro. Simply use one of these URLs:
- Unzip the downloaded archive and place it into its destination path.
- Note that you can use any path - be it
~\IHateUbuntu\SLES_WSL
, be itC:\Ubuntu
, etc.p.p.. It must, however, be on your system's drive (usuallyC:\
) Thanks, @Matt Wenham! - Via PowerShell:
Expand-Archive <ARCHIVE> <ITS_NEW_PATH>
- Via the File Explorer's GUI
- Or via any zipping tool, such as 7-Zip.
- Note that you can use any path - be it
- Run
Debian.exe
, which is inside the unzipped folder.- For the other distros, you just have to look for the correct EXE.
- This will now "install" your distro.
- Set your username and password.
- If error
0x80070005
shows up, you need to run the EXE as administrator. Thanks, @March Ho!
- If error
- It is recommended to update all software at the first start.
- In Debian & Ubuntu, this is done by running
sudo apt update && sudo apt upgrade
.
- In Debian & Ubuntu, this is done by running
- (Optional) Put your EXE into the Start Menu.
- Simply put a hard link of
Debian.exe
intoC:\ProgramData\Microsoft\Windows\Start Menu\Programs
.
- Simply put a hard link of
- (Optional) Repeat for as many distributions as you like to have.
You are good to go now. Run Debian.exe
whenever you want WSL to run.
This is a short procedure, applies for Windows 10 Fall Creators update and above.
- Enable "Windows Subsystem For Linux" feature from
OptionalFeatures.exe
and restart PC. From Windows Server Installation Guide. Download any one of the following file (with any browser or any download manager):
- Ubuntu:: https://aka.ms/wsl-ubuntu-1604 redirects to https://wsldownload.azureedge.net/Ubuntu.1604.2017.711.0_v1.appx (old link).
- OpenSUSE:: https://aka.ms/wsl-opensuse-42 redirects to https://wsldownload.azureedge.net/openSUSE-42_v1.appx (old link).
- SLES:: https://aka.ms/wsl-sles-12 redirects to https://wsldownload.azureedge.net/SLES-12_v1.appx (old link).
Open Appx packages with 7ZIP. Extract only the executable file (e.g. Ubuntu.exe) and install.tar.gz in any drive or any folder. Double click on that executable file and it will be installed.
Notes:: You can now install any GNU/Linux distribution using compressed RootFS tarballs (only .tar.gz) provided in distribution sites or from docker images.
You can (1) download the installers from the Windows Store or (2) download a distribution file and install it using tools such as lxRunOffline or WSL Distrolauncher.
- You can install Ubuntu 18 or many other distributions using the second option.
Downloading the installer from the Windows Store
You can download the installers from the Windows Store using Powershell. For instance, you can download the Ubuntu 16 version using the following command
PS> Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile Ubuntu.appx -UseBasicParsing
In the above command, the output file is Ubuntu.appx
. It must be named in that way. You can run that application to install the Ubuntu.
PS> Ubuntu.appx
Using LxRunOffline
First, you must download some distribution file. There are many distribution files available in the lxRunOffline wiki.
For instance, to install the same Ubuntu 16 from the Microsoft Windows Store, you can download the file at
https://lxrunoffline.apphb.com/download/UbuntuFromMS/16
Then, you can install the linux distribution using lxRunOffline
# lxrunoffline install -n <name> -d <folder> -f <distribution file>
C:\wsl> lxrunoffline install -n copy -d c:\wsl\copy -f 16.04.2-server-cloudimg-amd64-root.tar.gz
To run the distribution, you may use the same lxRunOffline
C:\wsl> lxrunoffline run -n copy -w
Using a DistroLauncher
You can use some DistroLauncher. There are many versions based on the Microsoft example to create custom linux distributions for WSL. For instance, you can use the Yuk7 version.
You must download a distribution file and the launcher.exe
. To use the same distribution file mentioned above, you must rename the distribution file to rootfs.tar.gz
and the launcher to the distribution name you want. Later you must run the launcher as an Administrator (I got errors running it as a normal user)
PS> ren launcher.exe mydistro.exe
PS> ren .\16.04.2-server-cloudimg-amd64-root.tar.gz rootfs.tar.gz
PS> .\mydistro
The first time you run the launcher, it installs and run the distribution. The next time, it runs the linux distribution.
After installing, you can manage the distributions using the wslconfig
or the lxrunoffline
commands.
NOTE: In addition to the distribution files mentioned above, you can create a new file based on other linux distributions. You may try the instructions included in the WSLInstall project. You may need additional steps after the installation to start the new linux correctly.