This page shows how to install Windows Subsystem for Linux (WSL) system on a non-system drive manually.

Enable Windows Subsystem for Linux system feature

Open PowerShell as Administrator and run the following command to enable WSL feature:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Create a folder in a non-system drive

Run the following command in PowerShell to create a folder for the installation. For my environment, I will create the folder in F drive.

cd F:\

mkdir WSL

cd WSL

Download a Linux distro

Run the following command in PowerShell to download a distro:

Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing

The following distros are available:

System URL
Ubuntu 18.04 https://aka.ms/wsl-ubuntu-1804
Ubuntu 18.04 ARM https://aka.ms/wsl-ubuntu-1804-arm
Ubuntu 16.04 https://aka.ms/wsl-ubuntu-1604
Debian GNU/Linux https://aka.ms/wsl-debian-gnulinux
Kali Linux https://aka.ms/wsl-kali-linux
OpenSUSE https://aka.ms/wsl-opensuse-42
SLEShttps://aka.ms/wsl-sles-12

Unpack the downloaded distro

Run the following PowerShell commands to unpack:

move .\Ubuntu.appx .\Ubuntu.zip

Expand-Archive .\Ubuntu.zip

Initialize Linux distro

In the unzipped folder, there is one executable (*.exe).

cd .\Ubuntu\

ls
     Directory: F:\WSL\Ubuntu


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       15/05/2019   7:40 PM                AppxMetadata
d-----       15/05/2019   7:40 PM                Assets
-a----       17/08/2018   3:15 AM         212438 AppxBlockMap.xml
-a----       17/08/2018   3:15 AM           3835 AppxManifest.xml
-a----       17/08/2018   3:17 AM          11112 AppxSignature.p7x
-a----       17/08/2018   3:15 AM      223983209 install.tar.gz
-a----       17/08/2018   3:15 AM           5400 resources.pri
-a----       17/08/2018   3:15 AM         211968 ubuntu1804.exe
-a----       17/08/2018   3:15 AM            744 [Content_Types].xml

* Based on the version of Linux distro you are using, the executable name can be different. 

Run the executable to initialize:

.\ubuntu1804.exe

PS F:\WSL\Ubuntu> .\ubuntu1804.exe
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: raymond
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

* You need to input a user name and password. I am using username raymond with ‘password’ as password.

Once the installation is done, you can see a new folder is created:

PS F:\WSL\Ubuntu> ls


     Directory: F:\WSL\Ubuntu


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       15/05/2019   7:40 PM                AppxMetadata
d-----       15/05/2019   7:40 PM                Assets
da----       15/05/2019   7:47 PM                rootfs
d-----       15/05/2019   7:49 PM                temp
-a----       17/08/2018   3:15 AM         212438 AppxBlockMap.xml
-a----       17/08/2018   3:15 AM           3835 AppxManifest.xml
-a----       17/08/2018   3:17 AM          11112 AppxSignature.p7x
-a----       17/08/2018   3:15 AM      223983209 install.tar.gz
-a----       17/08/2018   3:15 AM           5400 resources.pri
-a----       17/08/2018   3:15 AM         211968 ubuntu1804.exe
-a----       17/08/2018   3:15 AM            744 [Content_Types].xml

If you install WSL from Microsoft Store, the default folder in your Windows user profile will be used:

%localappdata%\Packages

rootfs folder includes the following folders:

PS F:\WSL\Ubuntu> cd .\rootfs\
PS F:\WSL\Ubuntu\rootfs> ls


     Directory: F:\WSL\Ubuntu\rootfs


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
da----       15/05/2019   7:47 PM                bin
da----       15/05/2019   7:44 PM                boot
da----       15/05/2019   7:44 PM                dev
da----       15/05/2019   7:48 PM                etc
da----       15/05/2019   7:48 PM                home
da----       15/05/2019   7:44 PM                lib
da----       15/05/2019   7:44 PM                lib64
da----       15/05/2019   7:44 PM                media
da----       15/05/2019   7:47 PM                mnt
da----       15/05/2019   7:44 PM                opt
da----       15/05/2019   7:44 PM                proc
da----       15/05/2019   7:44 PM                root
da----       15/05/2019   7:44 PM                run
da----       15/05/2019   7:44 PM                sbin
da----       15/05/2019   7:44 PM                snap
da----       15/05/2019   7:44 PM                srv
da----       15/05/2019   7:44 PM                sys
da----       15/05/2019   7:56 PM                tmp
da----       15/05/2019   7:46 PM                usr
da----       15/05/2019   7:47 PM                var
-a----       15/05/2019   7:56 PM          87944 init

These folders include all the Ubuntu folders (libs, executables, etc.).

List all the WSL installations

You can install many Linux distributions in one Windows system.

wslconfig command can be used to list all the installed distributions and set default distribution:

wslconfig
Performs administrative operations on Windows Subsystem for Linux

Usage:
     /l, /list [/all] - Lists registered distributions.
         /all - Optionally list all distributions, including distributions that
                are currently being installed or uninstalled.
     /s, /setdefault <DistributionName> - Sets the specified distribution as the default.
     /u, /unregister <DistributionName> - Unregisters a distribution.

Find out all the WSL installations in your Windows system using the following command:

wslconfig /l
Windows Subsystem for Linux Distributions:
Ubuntu-18.04 (Default)

Set default distribution:

wslconfig /setdefault Ubuntu-18.04

Run the following command to start the default WSL distribution:

wsl

image

To uninstall a distribution, use the following command:

wslconfig /u distribution_name

Now you have a WSL installed in a non-system drive. Have fun!

info Last modified by Raymond at 2 years ago * This page is subject to Site terms.

More from Kontext

local_offer hadoop local_offer linux local_offer WSL

visibility 14345
thumb_up 8
access_time 2 years ago

In my previous post , I showed how to configure a single node Hadoop instance on Windows 10. The steps are not too difficult to follow if you have Java programming backgr...

open_in_new Hadoop

local_offer spark local_offer pyspark

visibility 3982
thumb_up 0
access_time 13 months ago

When creating Spark date frame using schemas, you may encounter errors about “field **: **Type can not accept object ** in type <class '*'>”. The actual error can vary, for instances, the following are some examples: field xxx: BooleanType can not accept object 100 in type ...

open_in_new Spark + PySpark

local_offer zeppelin local_offer spark local_offer hadoop local_offer linux local_offer sqoop local_offer hive local_offer WSL

visibility 1099
thumb_up 0
access_time 2 years ago

This page summarizes the installation guides about big data tools on Windows through Windows Subsystem for Linux (WSL). ...

open_in_new Sqoop

local_offer linux local_offer sqoop local_offer WSL

visibility 1140
thumb_up 0
access_time 2 years ago

This page summarizes the steps required to install Apache Sqoop (v1.4.7) in Windows 10 environment via Windows Subsystem for Linux (WSL). Prerequisites If you have already installed Hadoop 3.2.0 in WSL, ignore the following steps as you don’t need to install it again. Follow&...

open_in_new Sqoop

info About author

comment Comments (0)

comment Add comment

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

No comments yet.

Dark theme mode

Dark theme mode is available on Kontext.

Learn more arrow_forward

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.


Learn more arrow_forward