Linux Subsystem for Windows

Sous-système Linux pour Windows
Linux Subsystem in Windows 10
Linux Subsystem under server 2019 preview

Linux Subsystem in Windows 10



1. Prerequisites


First of all, you must have Windows 10 in version 1709 minimum. The Windows Subsystem for Linux is present in the previous version but not in the same way.

2. Installation


First of all, To begin with, you have to install the "Windows subsystem for Linux" functionality by going to the control panel then "Programs and functionalities" and on the left you click on "Activate or deactivate Windows functionalities".



We will check "Windows Subsystem for Linux" and we do OK. The installation starts:



Once the installation is complete, we restart the PC.

3. The Linux distribution


When the PC is started, we can launch powershell and type the "bash" command which will tell us that we need to install a linux distribution from the store by giving us a link:





We copy / paste this link in a browser which will redirect us to the Microsoft store:



On the store we arrive on this distribution choice page:





We take the one we want, in our case we decided to test with Debian:



We select "Get" and the download starts:



Once finished, we do "Launch": :



A window opens and the installation of the OS itself is done:



The installation requires to choose a username and a password::





And here we are on our Debian:





4. Using our Linux Subsystem


To run our Debian, we simply launch Powershell and type "Bash" or with the Debian GNU / Linux icon: :



We can see the version of the kernel here:



Don't forget to update the sources first:



A general update is also recommended. Then you can install the application you want, example installation of apache2:



We check and start the service once installed:




We can then see, by going to our ip from a browser, that apache responds:




5. Conclusion


Using linux under Windows has become much simpler and above all much more complete with version 1709. This opening will allow Windows users to access linux tools without requiring passage through VMs or other machines that could generate significant complexity and cost. This system is very useful in the case for example of the administration of a linux web hosting.



Linux Subsystem under server 2019 preview



1. Prerequisite


We must use Windows Server 2019, in our case we chose it in Standard version and with Desktop Experience.

2. Installation of the Linux subsystem


For the installation, two possibilities:

- In GUI :
In the “Server Manager”, we go to “Add Roles and Features”. We do "Next" until you get to the Add Features page, check it and do the following until you install:




- In Powershell
All you have to do is run the following command:
Install-WindowsFeature Microsoft-Windows-Subsystem-Linux
After installation is complete, restart the server.

3. Installation of the distribution


Normally, we have to go through the Microsoft Store to download the distribution, however on a server it is problematic, here we will directly download the edition we want, example Ubuntu: Mkdir c:\temp Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile C:\temp\ubuntu.zip -UseBasicParsing
We will now decompress this file. In powershell the Expand-archive command can be used:
Expand-Archive C:\temp\ubuntu.zip c:\temp\ubuntu\
Now, we have a file called: c:\temp\ubuntu and a .exe named ubuntu.exe :




We launch it which starts the installation of the OS: :






Once the installation is complete you must choose a login and password: :




4. Using the Linux Subsystem


To start the linux environment, from a powershell or cmd window, we simply type "bash". The first thing to do is update the sources:




A complete system update is of course recommended.
We then install what we need, for example apache2:




We check the status of the service and start it if needed.




We can then connect to the site page directly from our IP or in localhost:




5. Conclusion


With the integration of the Linux subsystem into Windows Server, Microsoft allows administrators to mix their Windows and Linux infrastructures without having to use different servers, such as hosting everything through an efficient virtual server . More and more it is becoming possible to mix technologies from these two worlds which were however so different a few years ago. This integration can be useful not only for administrators but also for developers to have both environments in one.

Add new comment