The Linux subsystem introduced in Windows 10 1609 brought some innovations in Windows 10 1809. Also new is that it is available on the server for the first time with version 2019. Because there is no Store app, you install it via the command line. This also applies to Windows 10 in the Long-Term Servicing Channel (LTSC).

Wolfgang Sommergut

Wolfgang Sommergut has over 20 years of experience in IT journalism. He has also worked as a system administrator and as a tech consultant. Today he runs the German publication WindowsPro.de.

The Windows Subsystem for Linux (WSL) is intended for use on software developers' computers and for test environments. However, it is not suitable to run Linux applications for productive use. This is true even if you install WSL on the server.

Closer integration of WSL with Windows ^

The special advantage of the Linux subsystem is its close integration with Windows. This allows native Linux programs in Executable and Linkable Format (ELF) to start unmodified from the Linux shell. These programs can then access the file system of Windows and the network.

However, because of the differences between the systems and the architecture of WSL, constraints and inconsistencies are not entirely avoidable. This applies, for example, to accessing the hardware in the Linux environment, where the content of /dev is quite limited.

You can find almost only tty devices in WSL Ubuntu under :dev

You can find almost only tty devices in WSL Ubuntu under :dev

In contrast to Windows, Linux has case-sensitive file names. And it uses only \n for line breaks, while Windows uses \r\n. In addition, Linux has its own user and rights management.

The last update brought some improvements. Notepad can now correctly display line breaks in files created with Linux programs.

Notepad now preserves the type of line breaks

Notepad now preserves the type of line breaks

In addition, it is now possible not only to mount volumes as case-(in)sensitive but also to mark individual directories accordingly as well.

This is possible from within the WSL and also from Windows on volumes mounted with drvfs (e.g., the Windows C: drive under /mnt/c). On the Linux side, the commands used are getfattr (to display) and setfattr (to change). Under Windows, these commands serve the same purpose:

Querying whether a directory has been marked as case sensitive

Querying whether a directory has been marked as case sensitive

As a further integration of the WSL, holding down the Shift key and right-clicking on a directory with the mouse can now start the Linux shell directly from the File Explorer.

Starting the Linux shell from the File Explorer

Starting the Linux shell from the File Explorer

Since build 18342 of Windows 10 1903 you can now navigate through the directory tree of the Linux distribution with the Explorer. It is mounted under the UNC path \\wsl$.

You can display files in the Linux directories in the Explorer from Windows 10 1903 onwards

You can display files in the Linux directories in the Explorer from Windows 10 1903 onwards

Accordingly, you can also use this command in PowerShell to change to an Ubuntu installation:

In the newest version, the user has several Linux distributions to choose from. Initially only Ubuntu was available. Since the individual distributions are installed as Appx packages, you can run Ubuntu, Debian, and SuSE side by side.

Available Linux distributions for WSL in the Microsoft Store

Available Linux distributions for WSL in the Microsoft Store

WSL is still limited to programs for the command line because it doesn't include an X server. As a pure console environment, the subsystem can also function under Server Core. You can install one of the freely available X servers yourself, but there’s no support for this. If you need GUI programs for Linux, I recommend using a virtual machine.

Installing WSL ^

Adding a Linux environment is quite easy under Windows 10. Activate the feature in the Control Panel, restart the computer, and then fetch the desired distribution from the Microsoft Store.

Activating the Linux subsystem in the Control Panel

Activating the Linux subsystem in the Control Panel

If the WSL feature is not available for selection, you are probably using a 32-bit version of the OS instead of the required 64-bit version.

This procedure does not work for Windows 10 LTSC and Windows Server because the Store app is missing. Therefore, you have to download the Appx package and install it yourself.

There is no web browser available under Server Core, and you can only activate the feature via the command line. Hence you would use a pure PowerShell solution in this case, which of course also works everywhere else.

To add the subsystem in a PowerShell session with administrative privileges, issue this command:

Adding a Linux subsystem using PowerShell

Adding a Linux subsystem using PowerShell

Under Windows Server 2019, the following cmdlet works as well:

Downloading a distribution ^

After the mandatory restart, you can download the desired distribution. You do not need administrative privileges to install the distribution because this takes place in the user's profile. The download links are:

You can use curl.exe or the Invoke-WebRequest cmdlet to download. For example, to get Ubuntu 18.04, you would enter this command:

It then saves the Appx package as a .zip archive, so you don't have to rename the file extension subsequently. The UseBasicParsing switch allows PowerShell to bypass Internet Explorer.

Downloading and unpacking Ubuntu 18.04 for WSL in PowerShell

In the next step, you unpack the .zip file by typing this command in the desired installation directory:

Installing Ubuntu 18.04 for WSL

Installing Ubuntu 18.04 for WSL

Now change to the folder ubuntu and execute ubuntu1804.exe. The following process takes a few minutes, and after creating a user and selecting a password, you will end up at the prompt of the Linux shell.

Are you an IT pro? Apply for membership!

4+

Users who have LIKED this post:

  • avatar
  • avatar
  • avatar
  • avatar
Share
1 Comment
  1. Scott 1 month ago

    When I follow these instructions for Kali Linux, I don't see a "kali.exe" or any other EXE when I extract the ZIP file.

    0

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2019

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account