WSL: How to install and use the Ubuntu subsystem in Windows 10

Neofetch on Windows 10

Three years ago, Microsoft he presented WSL, which is the acronym for Windows Susbystem for Linux. As an Ubuntu user I thought "This is useless, I will never use it if I already use Ubuntu as a native", but was I right? Probably not. I have just started using WSL on Windows 10 because I am a Linux user, because the Ubuntu terminal It offers us very interesting possibilities that are worth having on hand.

Logically, it is not perfect. As we will explain below, there will be some tasks that we cannot perform, partly because what we are going to install and use is only a terminal, that is, a window in which we will enter the command lines to do what we need. Next I explain the steps to follow to install the Ubuntu 18.04 terminal in Windows 10 and what we can do with it.

WSL, running Linux commands on Windows 10

Before we can use it, we have to install it. The steps to follow would be the following:

  1. We go to the Microsoft Store and install Ubuntu 18.04.

Install Ubuntu 18.04 from the Microsoft Store

  1. Next, we have to run the following command as administrator. To do this, we right click on Start and choose "Windows PowerShell (Administrator)":
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Activate WSL

  1. We wait for WSL to be activated. Once the process is finished, we have to restart. By default, it is marked as "yes", so we can restart by pressing Enter. We can also do the first steps in reverse: first activate WSL and then install Ubuntu.

Installing WSL

  1. Next, we start Ubuntu from the applications menu.
  2. We wait a while for the system to install.

We wait for the system to install

  1. When the time comes, it will ask us for a username. We have to enter it in lowercase and press Enter.
  2. For the password, we will do the same as anywhere else: put it once, press enter, put it again to confirm it and press Enter again.

Enter username and password

And that would be all. We already have the Ubuntu terminal installed on Windows. By default we can already use commands like APT, so the first test I recommend is to install "neofetch":

sudo apt install neofetch

To launch it and see something like the header image, you just have to type "neofetch" without the quotes. It seems important to mention that We can launch the Linux commands from the Windows PowerShell or directly from the option «Execute«.

What we can and cannot do with WSL

GUI programs do not work in WSL

What you have to be clear about is what a terminal is. Explained fast and wrong, it is an operating system that works solely and exclusively with command lines and it cannot display images beyond the text we input / display. This means that, for example, we can install any program that is available in the Ubuntu repositories, but we cannot launch those that make use of a GUI, such as Firefox (although it would not make sense to install anything that is officially available for Windows) . It also means that we will not be able to follow, for example, this tutorial to record screen with ffmpeg: if we enter the command and press Enter, the task will start, but will stop when it realizes that "there is no monitor available".

At the time of writing this article, also not compatible with Snap packages, so I have not been able to test a package that allows us to view GIFs from the terminal (I will probably write an article about it).

But since we mentioned ffmpeg, say that yes we can use it to convert files, something that we explain in this other article. But first we have to install the software and all its dependencies (sudo apt install ffmpeg). We can also install ImageMagick and do this other, which will allow us to convert / edit images in batches.

But there is a little problem with the routes ...

Something that I would like them to fix in the future is related to the routes. They are not the same and he does not recognize them the same. The problem is how Windows writes them and how Linux needs them. The good thing is, it's easy to remember how to convert a path from Windows to Linux.

For example: the path C: \ Users \ Pablo \ Destktop \ Windows would be / mnt / c / Users / Pablo / Desktop. Knowing it, if we ever want to drag a Windows file to the Ubuntu terminal, what we have to do is basically change backslashes to normal bars, put the lowercase «c», remove the colon and in front add «/ mnt /». It is not difficult to remember.

And this is how WSL is installed and used in Windows 10. Taking into account the capacity of the hard drives of current computers and the possibilities it offers us, I think it is worth having it installed. And I leave the article with the following command:

exit


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   user said

    Very useful, thanks to this tutorial, without knowing anything about Linux, I have been able to install and understand a little what is explained.
    Thanks a lot ?

  2.   Daniel said

    I already installed and I was doing tests, but I can't know how to use the programs that I have installed in Ubuntu from windows and their applications.
    For example, if I want to use git, which comes with ubuntu, from visual studio code installed on windows, how would I do it?
    Or if you wanted to use docket or apache and mysql, among other things.
    The idea is to be able to cross-use Linux applications from Windows, without entering the console.

    1.    Raimundo said

      Daniel, I suggest you try Laragon. It is a very interesting solution for Windows. (It doesn't run on Linux.)
      Of all the web development environments it is the most complete. Bring Apache 2.4, Nginx, MySQL 5.7, PHP 7.4, Redis, Memcached, Node.js 14, npm, git and you can enhance it by installing (bah, unzipping a ZIP in a certain folder) the following: phpmyadmin, Node.js / MongoDB , Python / Django / Flask / Postgres, Ruby, Java, Go.
      I stopped using XAMP and WAMP because it is really simple and brings everything you need.

  3.   Sebastian Valencia Carvajal said

    Hello, can you help me? I get the following error in the ubuntu terminal on windows:
    "WslRegisterDistribution failed with error: 0x80370102
    Error: 0x80370102 The virtual machine could not be started because a required feature was not installed. "
    It should be clarified that you do exactly all the steps indicated.
    Thanks in advance.

  4.   Horace Lobato Escoto said

    Very good contribution.

    I want to share that I just did a test installing Ubuntu 20.04 lts in WSL, previously I already had an X server installed, XMING. Running the XMING server first, in the Ubuntu session we declare the environment variable DISPLAY =: 0.0, with this you can now install and run Ubuntu graphical applications.

    Hope this helps someone.

    regards

  5.   Raimundo said

    In my work I installed it without problems, but at home the Microsoft Store throws me an error "Code: 0x80131500" and there is no way to reset it. They recommend formatting and installing windows, but I don't want to make so much trouble. I just wanted to use it but I have no way to download the Ubuntu app from the Store. Is there a way to get that version of Ubuntu outside of the Microsoft Store? Greetings!

  6.   Super said

    There is a lot of problem, setting the power shell modalità amministratore, wsl di default version 1.
    wsl --set-default-version 1

    What I did follow fa vedere le versione per le varie app
    wsl --list --verbose
    poi potete far manual
    wsl –set-version nome app (verbose list) version number

    follow my blog super-blog-info.blogspot.com

  7.   JUICE said

    Hello, how have I been using this console for years since it came out, the truth is that it has made many tasks easier for me, since the filter commands, AWK, etc. are very useful for dealing with files in windows, but I wanted to know if it is possible to configure it with Putty or some other another client.

    Greetings and very good tutorial