Wsl install windows 10 ubuntu

Contribute to this page

Toggle table of contents sidebar

What you will learn¶

  • How to enable and install WSL on Windows 10 and Windows 11

  • How to install Ubuntu 24.04 LTS using the Microsoft Store or WSL commands in the terminal

What you will need¶

  • Windows 10 or 11 running on either a physical device or virtual machine

  • All of the latest Windows updates installed

Install WSL¶

You can install WSL from the command line. Open a PowerShell prompt as an Administrator (we recommend using Windows Terminal) and run:

It is recommended to reboot your machine after this initial installation to complete the setup.

Install Ubuntu WSL¶

There are multiple ways of installing distros on WSL, here we focus on two: the Microsoft Store application and WSL commands run in the terminal. The result is the same regardless of the method.

Method 1: Microsoft Store application¶

Find the distribution you prefer on the Microsoft Store and then click Get.

Installation page for Ubuntu 24.04 LTS in the Microsoft store.

Ubuntu will then be installed on your machine. Once installed, you can either launch the application directly from the Microsoft Store or search for Ubuntu in your Windows search bar.

Search results for Ubuntu 24.04 LTS in Windows search bar.

Method 2: WSL commands in the terminal¶

In a PowerShell terminal, you can run wsl --list --online to see an output with all available distros and versions:

The following is a list of valid distributions that can be installed.
The default distribution is denoted by '*'.
Install using 'wsl --install -d <Distro>'.

  NAME                                   FRIENDLY NAME
* Ubuntu                                 Ubuntu
  Debian                                 Debian GNU/Linux
  kali-linux                             Kali Linux Rolling
  Ubuntu-18.04                           Ubuntu 18.04 LTS
  Ubuntu-20.04                           Ubuntu 20.04 LTS
  Ubuntu-22.04                           Ubuntu 22.04 LTS
  Ubuntu-24.04                           Ubuntu 24.04 LTS
...

Your list may be different once new distributions become available.

You can install a version using a NAME from the output:

> wsl --install -d Ubuntu-24.04

You’ll see an indicator of the installation progress in the terminal:

Installing: Ubuntu 24.04 LTS
[==========================72,0%==========                 ]

Use wsl -l -v to see all your currently installed distros and the version of WSL that they are using:

  NAME            STATE           VERSION
  Ubuntu-20.04    Stopped         2
* Ubuntu-24.04    Stopped         2

Note on installing images without the Microsoft Store¶

If you do not have access to the Microsoft Store or need to install
a custom image it is possible to import a distribution as a tar file:

> wsl --import <DistroName> <InstallLocation> <InstallTarFile>

Appx and MSIX packages for a given distro can also be downloaded and installed.
Please refer to Microsoft’s documentation for more detailed information on these installation methods:

  • Importing Linux distributions

  • Installing distributions without the Microsoft Store

Warning

You should always try to use the latest LTS release of Ubuntu, as it offers the best security, reliability and support when using Ubuntu WSL.

Currently we do not have a recommended location from which to download tar and Appx/MSIX files for Ubuntu distros.

Run and configure Ubuntu¶

To open an Ubuntu 24.04 terminal run the following command in PowerShell:

Once it has finished its initial setup, you will be prompted to create a username and password. They don’t need to match your Windows user credentials.

Finally, it’s always good practice to install the latest updates by running the following commands within the Ubuntu terminal, entering your password when prompted:

$ sudo apt update
$ sudo apt full-upgrade -y

Enjoy Ubuntu on WSL¶

In this guide, we’ve shown you how to install Ubuntu WSL on Windows 10 or 11.

We hope you enjoy working with Ubuntu in WSL. Don’t forget to check out our blog for the latest news on all things Ubuntu.

Further Reading¶

  • Setting up WSL for Data Science

  • Whitepaper: Ubuntu WSL for Data Scientists

  • Microsoft WSL Documentation

  • Ask Ubuntu

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Are you eager to run Ubuntu alongside your Windows 10 system? With the Windows Subsystem for Linux (WSL) 2, you can easily achieve that, for more details WSL 2 was introduced in Windows 10 version 2004. This guide will walk you through the steps to install either Ubuntu 20.04 or 22.04 in WSL 2 on your Windows 10 machine.

Before you start, ensure you have the following:

  • A Windows 10 machine with version 2004 or later.
  • A Microsoft account with admin privileges.
  • Windows Subsystem for Linux (WSL) feature enabled on your Windows 10 machine.
  • Open PowerShell with administrative privileges.

These are the step-by-step process what you need to do:

  1. Check your Windows version and build number.
  2. Verify administrator privileges.
  3. Enable the Windows Machine Platform feature.
  4. Enable the Windows Subsystem for Linux (WSL) feature.
  5. Install Ubuntu 20.04 or 22.04 in WSL 2.
  6. Optional: Install Ubuntu in WSL 2 via PowerShell.
  7. Configure Ubuntu user account and password.

Step 1: Check your Windows version and build number

Firstly, you need to check your Windows version and build number to ensure compatibility with the Windows Subsystem for Linux (WSL) feature. Follow these steps:

  1. Open PowerShell with administrative privileges.
  2. Type the following command and press Enter:
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

  1. Look for the output that includes your “OS Name” and “OS Version.”
  • For compatibility with WSL 2, your Windows version should be 2004 or later, and the build number should be 19041 or later.
  • Ensure that the output includes the Windows version and build number that meets or exceeds these requirements.

If your Windows version and build number meet these criteria, then your system is compatible with Windows Subsystem for Linux (WSL) 2. If not, you may need to update your Windows operating system to a compatible version.

Step 2: Verify administrator privileges

To determine if your user account has administrative privileges using the whoami /groups command in Windows, look for the presence of the “Administrators” group in the output. Here’s how to do it:

  1. Open PowerShell with administrative privileges.
  2. Type the following command and press Enter:
  1. Look for the “S-1-5-32-544” entry in the output.
  • If you see “S-1-5-32-544” listed, it means your user account belongs to the “Administrators” group, indicating administrative privileges.
  • If you don’t see “S-1-5-32-544” listed, it means your user account does not have administrative privileges.

If your user does not have administrator privileges, log in as an administrator or ask an administrator to elevate your privileges.

Step 3: Enable Windows features

Enable the required Windows features for WSL 2:

  • Open PowerShell with administrative privileges.
  • Run the following command:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

The command above typically enables the Windows Subsystem for Linux (WSL) feature without requiring a restart. However, there can be cases where a restart is necessary for the changes to fully take effect, depending on your system configuration or settings. So, much better to restart your machine ?.

Step 4: Enable WSL feature

To determine if WSL 2 is enabled on your machine using both PowerShell and the DISM command, follow these steps:

  1. Open PowerShell with administrative privileges.
  2. Enter the following command and press Enter:
Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -eq "VirtualMachinePlatform"}
  1. If WSL 2 is enabled, you’ll see output similar to:
FeatureName : VirtualMachinePlatform
State       : Enabled
  1. Additionally, you can use the DISM command to check:
dism.exe /online /get-features | Where-Object { $_ -match "Microsoft-Windows-Subsystem-Linux" }

Output:

Feature Name : Microsoft-Windows-Subsystem-Linux

Otherwise, you can go to ‘Turn Windows features on or off‘ in your Windows settings to verify if the Windows Subsystem for Linux is enabled.

Once the WSL feature is enabled, you can install Ubuntu from the Microsoft Store or using the wsl command. Here’s how:

  • Open the Microsoft Store and search for “Ubuntu 20.04” or “Ubuntu 22.04”.
  • Click on the desired app and click the “Get” button to download and install it.
  • After installation, launch Ubuntu from the Start menu.

Step 6: Optional – Installing Ubuntu in WSL 2 via PowerShell

Alternatively, you can install Ubuntu in WSL 2 using PowerShell commands:

  • List the available WSL distributions:
  • Install Ubuntu:
wsl --install -d Ubuntu-20.04
  • Set WSL 2 as the default version:
wsl --set-default-version 2
  • Check the installed distributions:
  • Verify the Ubuntu version:

Final Step: Configure Ubuntu user account and password

Upon installation, follow the prompts to create a user account and password for Ubuntu.

Creating new user account...
username:

After following these steps, you’ll have Ubuntu 20.04 or 22.04 installed in WSL 2 on your Windows 10 machine. Enjoy the seamless integration of Linux with your Windows environment!

Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.19.104-microsoft-standard x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

0 packages can be updated.
0 updates are security updates.


The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

username@Ubuntu:~$

For troubleshooting Windows Subsystem for Linux, refer to Microsoft’s official documentation.

In this article, we’ll learn to install Ubuntu on Windows. Windows Subsystem for Linux or WSL is a functionality developed by Microsoft to use basic Linux functionalities natively on its Windows 10 operating system and Windows 10 Server.

With help of WSL, you no more need to dual-boot your system or have a Linux VM (Virtual Machine) to use the Linux environment because it provides all the command-line tools, applications, and utilities needed by most Linux users.

WSL makes your Windows system do all that natively, like running Linux binaries and operating on Windows files using Linux terminal.

In this article, we will go through the complete process on installing WSL on your Windows powered desktop.

Pre-requisites for WSL

There are few basic pre-requisites to get Ubuntu WSL up and running on your Windows system, like –

  1. Pre-installed Windows OS on your system
  2. A good Internet connection
  3. Microsoft Store signed in with a Microsoft Account

If you haven’t yet signed-in to Microsoft Store, click on icon at the top-right in Microsoft Store. And log-in with your credentials.

Let’s get started with set up and install Ubuntu on Windows.

1. How to enable WSL on your Windows system?

For setting up WSL on your Windows system, you need to enable a few Windows features as they are set to OFF by default. You can also turn these features ON by using PowerShell commands, as seen in most articles related to WSL.

Click on

Windows 10 Logo Png Download 512512 Free Transparent Windows Windows Key Png 900 520

key and search for “windows features“, it will show the “Turn Windows features on or off” option from Control Panel.

Double click or hit Enter to open it and a dialog box will appear.

Windows Features

Windows Features

From this dialog box, tick on the checkboxes “Virtual Machine Platform” and “Windows Subsystem for Linux”.

Windows Features Turn On WSL

Windows Features Dialog Box

Now, you have enabled WSL (Windows Subsystem for Linux) for your system. Apart from this, you need to have a Linux distribution for your WSL, which we will download and install via Microsoft Store.

2. Install Ubuntu on your WSL

Now, open your Microsoft Store and search for Ubuntu.

Search Results Ubuntu

Search Results – Ubuntu

Choose any of the listed Ubuntu distributions from the search results, and it will show an Install button above the application panel. Click on the Install button and wait for a moment, the installation will shortly begin.

Note: Make sure you have logged-in to the Microsoft store, else it will prompt you to login after clicking on Install.

Microsoft Store Ubuntu

Installing Ubuntu WSL from Microsoft Store

After all this, on first startup your WSL will ask to setup log-in credentials for your WSL, to finish installation.

3. Running Ubuntu distribution using WSL

After the Ubuntu WSL (Windows Subsystem for Linux) is installed, a Launch button will appear. Click on the Launch button to start the Ubuntu WSL.

You can also open it from your Start menu, as a new entry named “Ubuntu” will be added there for easy access.

Ready To Launch WSL

Ready To Launch Ubuntu WSL

When you launch the Ubuntu WSL for the first time, it will ask you to wait for some time to complete its setup and after that it will ask you to enter login credentials of your choice.

WSL Setup

Setting up log-in credentials for Ubuntu WSL

After setting up the credentials, your Ubuntu WSL is ready.

WSL Start

WSL setup completed

To check if your Ubuntu WSL works properly, you can run any Linux command of your choice as now you have a fully operational Linux terminal which can run anything natively as your original Linux system does.

WSL Started

Checking WSL

Bonus

  1. You can run the native terminal of Ubuntu, OpenSUSE, Kali with WSL on your Windows machine.
  2. You can find any of the supported distributions for your WSL on Microsoft Store and use it.
  3. The Linux Kernel used by Microsoft’s WSL is openly available on GitHub, you can check out its code here.

Conclusion

In this article, we learned the process for setting up WSL (Windows Subsystem for Linux) on our Windows system and how we can use all the basic Linux functionalities on our system without doing much hassle. We also discussed that we can also use various other distributions with WSL, which are available on Microsoft Store.


Среда Windows Subsystem for Linux (WSL) позволяет запускать нативные приложения, писать скрипты, выполнять команды и скрипты Linux непосредственно из Windows без использования эмуляторов или развертывания выделенных виртуальных машин. Актуальной версией среды является WSL 2, в которой используется полноценное ядро Linux (версия ядра 5.15) и обеспечивает полную совместимость с системными вызовами. Образ ядра Linux в WSL представляет собой легкую виртуальную машину, для запуска которой не нужно устанавливать полноценную роль Hyper-V.

Содержание:

  • Как установить Windows Subsystem for Linux (WSL2)?
  • WSL: Установка дистрибутива Linux в Windows
  • Команды для управления WSL в Windows
  • Использование Linux в среде WSL

Вы можете запустить WSL 2:

  • Во всех версиях Windows 10, начиная с 1903, а также в Windows 11 и Windows Server 2022;
  • В настройка BIOS/UEFI компьютера должна быть включена поддержка аппаратной виртуализации: Intel VT (Intel Virtualization Technology) или AMD-V (SVM Mode).

Как установить Windows Subsystem for Linux (WSL2)?

Компонент WSL по умолчанию отключен в Windows. Современных дистрибутивах Windows 10 и Windows 11 для установки среды WSL достаточно выполнить команду:

wsl --install

Этак команда автоматически включит все необходимые компоненты Windows, необходимые для работы WSL, установить обновление ядра Linux для WSL2, загрузит дистрибутив Ubuntu (по-умолчанию) и установит его в WSL.

команда для быстрой установки wsl в windows 10 и 11

Осталось перезагрузить компьютер, и вы можете запускать среду WSL!

Вы можете установить для WSL другой дистрибутив Linux. Выведите список доступных дистрибутивов:

wsl --list --online

Укажите имя дистрибутива Linux, который установить в WSL. Например:

wsl --install -d kali-linux

список доступных дистрибутивов Linux для WSL

Если в BIOS/UEFI компьютера не включена виртуализация, при установке WSL вы получите ошибку:

Installation failed with error 0x80070003 or error 0x80370102” it means that Bios Level Virtualization is not enabled on your computer.

Вы можете установить WSL2 в Windows вручную. Для этого придется вручную последовательно выполнить все этапы, который команда wsl —install запускала автоматически:

  1. Установить WSL
  2. Включить компонент виртуалзации VirtualMachinePlatform
  3. Установить ядро WSL 2
  4. Скачать и установить дистрибутив Linux для WSL

Сначала установите следующие компоненты Windows:

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

установить компонент wsl в windows вручную

Перезагрузите компьютер.

Скачаем и установим обновление ядра Linux для WSL2 (WSL2 Linux kernel update package for x64 machines — https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi). Можете скачать пакет вручную или с помощью PowerShell:

Invoke-WebRequest -Uri https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi -OutFile "$($env:userprofile)\Downloads\wsl_update_x64.msi" -UseBasicParsing
Invoke-Item "$($env:userprofile)\Downloads\wsl_update_x64.msi"
rm "$($env:userprofile)\Downloads\wsl_update_x64.msi"

windows subsyste for linux update setup

Еще раз перезагрузите компьютер и назначьте версию WSL 2 в качестве среды по-умолчанию:

wsl --set-default-version 2

wsl2 назначить по умолчанию

WSL: Установка дистрибутива Linux в Windows

После того, как ядро WSL установлено в Windows, вы можете установить один или несколько дистрибутивов Linux на компьютер.

Можно установить пакет с дистрибутивом Linux через Microsoft Store. Доступны следующие дистрибутивы:

  • Ubuntu
  • Debian
  • Kali Linux
  • OpenSUSE
  • Oracle Linux
  • SUSE Linux Enterprise Server
  • Fedora

Найдите нужную версию дистрибутива в Store и установите ее, нажав кнопку Получить (Get).

скачать образ linux для wsl из microsoft store

Если у вас отключен Windows Store, вы хотите установить дистрибутив WSL в Core редакции Windows Server или вам нужно установить WSL на Изолированном от интернета компьютере (оффлайн), вы можете скачать дистрибутив Ubuntu с помощью PowerShell командлета Invoke-WebRequest:

Invoke-WebRequest https://aka.ms/wslubuntu2204 -OutFile ubuntu-2204.appx –UseBasicParsing

Установите пакет для WSL с помощью:

Add-AppxPackage .\ubuntu-2204.appx

После окончания установки появится окно, в котором вам будет предложено указать имя пользователя и пароль для вашего дистрибутива.

задать пароль для wsl

После установки вы можете в меню Пуск появится отдельная программа для запуска Linux.

Также вы можете запустить ваш Linux из отдельной вкладки Windows Terminal или с помощью команды
wsl
.

Команды для управления WSL в Windows

Рассмотрим основные команды для управления ядром и дистрибутивами Linux в WSL.

Проверить текущую версию ядра WSL:

wsl --version

версия wsl в windows

Обновить ядро WSL вручную:

wsl --update

Откатится к предыдущему ядру WSL:

wsl --update rollback

Вывести список установленных версий Linux:

wsl --list

Вывести дистрибутив Linux, который используется по-умолчанию:

wsl --status

Дистрибутив Linux по-умолчанию в WSL можно изменить:

wsl --setdefault Ubuntu

Запустить определенный дистрибутив в WSL:

wsl -d kali-linux

Завершить среду WSL:

wsl --shutdown

Можно войти в WSL Ubuntu под root и сбросить пароль:
ubuntu config --default-user root
Passwd

Вернуть пользователя по умолчанию
ubuntu config --default-user your_username

Для настройки параметров WSL и дистрибутивов Linux используются конфиг файлы:

  • wsl.conf – файл с настройками конкретного дистрибутива Linux (находится в директории /etc)
  • .wslconfig – глобальные настройки WSL, которые применяются ко всем дистрибутовам (находится в профиле пользователя в
    %UserProfile%
    )

Например, если вы хотите ограничить использование оперативной памяти и CPU компьютера дистрибутивами Linux в WSL, создайте такой файл
%UserProfile%\.wslconfig
:

[wsl2]
memory=2GB
processors=2

Использование Linux в среде WSL

Дистрибутив Linux, установленный в WSL является полноценной операционной системой. Поэтому после установки рекомендуется выполнить обновление пакетов. Для Ubuntu выполните команду:

$ sudo apt-get update && sudo apt-get upgrade -y

обновление пакетов в ubuntu wsl

Файловая система вашего дистрибутива Linux хранится в профиле пользователя в виде VHDX файла. Например, виртуальный диск Ubuntu хранится в папке
%USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState

файл vhdx образа диска в linux wsl

Файловая система Linux в WSL монтируется в виде сетевой папки прямо в проводник Windows.

Также для прямого доступа к файлам WSL из Windows можно использовать UNC путь. Например:

notepad \\wsl$\Ubuntu\sysops\home\1122.txt

В свою очередь локальные диски Windows монтируются в WSL в папку mnt. Вывести список файлов папок на диске C:

wsl
ls /mnt
ls/mnt/c

просмот файлов на диске windows из wsl

Другие примеры запуска Linux команд из Windows:
dir | wsl grep Sa
wsl ls ‑la > 123.txt
wsl ls ‑la /proc/cpuinfo
wsl ls ‑la “/mnt/c/Program Files”

Вы можете установить любые пакеты в Linux. Например, установите файловый менеджер Midnight Commander:

$ sudo apt-get install mc

В современной версии WSL 2 вы можете запускать из Windows любые приложения Linux с графическим интерфейсом (X11 и Wayland). Например, установите графический редактор:

$ sudo apt install gimp -y

Чтобы запустить его из Windows просто выполните команду:

wsl gimp

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Сопроцессор драйвер windows 10 amd
  • Windows 7 home basic oa cis and ge torrent
  • Hp laserjet pro mfp m125ra драйвер windows 10 x64
  • Windows run command in folder
  • Разблокировщик для windows 10