Установка debian из под windows

Debian is one of the oldest Linux distributions available that is currently being maintained actively. Ubuntu, which is the most popular Linux distribution, is based upon the experimental version ‘Sid’. And Ubuntu in turn acts as a base for numerous operating systems such as Linux Mint, Pop_OS!, Linux Lite, etc. Debian is mostly used by servers around the world because Debian is very stable.

Microsoft has recently updated their WSL or Windows Subsystem for Linux to version 2 (termed WSL2) and the Linux instance installed is more usable for all users now. In this tutorial, we will try to install this Debian Linux on our Windows machine using WSL2.

Enable/Install WSL2

If you are using Windows 11, WSL2 is already installed on your system, and you just have to enable it. We will discuss this after learning to install this on Windows 10. Windows 10 users have to first enable WSL on their system. From the Start Menu, search and run Turn Windows features on or off, and launch it. From Here, enable ‘Virtual Machine Platform‘ and ‘Windows Subsystem for Linux‘ and click OK and restart your PC.

Turn On WSL2

Turn On Windows Subsystem For Linux

Now, search and open ‘PowerShell’ application and right-click upon it to run it as administrator. Now, just type the following command and press the Enter key on your keyboard :

Run Powershell As Administrator From The Start Menu

Run PowerShell As Administrator From The Start Menu
wsl --set-default-version 2
wsl --list --online

If you are using Windows 11, open the ‘PowerShell’ application as Administrator and then run the following command :

wsl --set-default-version 2
wsl --list --online

Installing Debian on WSL2

List Available Distributions On WSL2 1

List of Available Distributions On WSL2

Now, the default version that is installed on your PC is Ubuntu (marked by an asterisk here), to install Debian, you can run the following command :

Installing Debian Using WSL2

Installing Debian Using WSL2

If prompted, you should also reboot your system.

Post installation tweaks

Once you restart your PC, you will see a Terminal window waiting for you asking you to create a Username and Password.

Enter Your Username And Password And You Are Now Done With The Installation

Enter Your Username And Password And You Are Now Done With The Installation

Now, you should also update your system to the latest version using the apt command, type the following in your Debian Machine :

sudo apt update && sudo apt full-upgrade
Update Your Debian Installation

Update Your Debian Installation

Summary

While WSL2 provides the complete command line experience to any developer/user, it is still not a complete replacement for actual Installation on a Virtual machine or on bare metal. Applications do not have hardware acceleration and hence drain the battery more and so on. It is still a good decision from Microsoft as many people will have the exposure to Linux command line and maybe even encourage people to fully switch to the Linux Desktop

References

Microsoft’s Official WSL2 Documentation


0

2

Надеюсь, все знают, что в образе дебиан есть установщик дебиана под вин — setup.exe
Пробовал под виртуал боксом — все норм,но без вкл. уефи, поэтому есть несколько вопросов:
Предположим, я в венде в режиме уефи, секьюре бут вырубил.
Сможет ли дебиан установиться из винды (в режиме uefi)- то есть добавить свой загрузчик, чтобы при перезагрузке я увидел выбор и пошел грузить инсталляцию дебиана?
Кто пробовал — оно работает?
Должно выглядеть так:
Старт винды, запуск инсталлера дебиана, перезагрузка, выбор пункта загрузки дебиана, далее инсталляция дебиана на весь диск, при этом при включ. ефи.
Пробовать поздно — снес винду и инсталлил тукса при легалеси, а ведь получается мог из-под винды в уефи?… или таки нет?

Installing Debian on Windows 10/11 using WSL from the command line

I have been using WSL for some time now, and with it Ubuntu on my Windows machine, but since I switched to WSL2, the startup time has increased from «instant» to 10 seconds.

It wouldn’t let me reset it to WSL1, so if I’m going to reinstall WSL for this anyway, I’ll see what other distributions are available besides Ubuntu. Because there are.

If you’ve been reading my blog for a long time, you’ve probably seen me mention that I’m using Windows 10 LTSC. This has many advantages (and disadvantages), I don’t intend to go into them in this article.

One of those disadvantages (for some, for me it’s an advantage) is that it doesn’t have a Microsoft Store. And if you want to use a distribution other than the default Ubuntu, you will need it. Right? No.

So why did I choose Debian?

  1. For one thing, all my servers are running Debian (including Raspberry Pi), so it’s handy.
  2. Secondly, because of its size. If you look at the size in the MS Store linked above, you can currently see that Ubuntu will download 608MB, while Debian requires only 93.5MB. That is a significant difference.Used storage after the installation with Ubuntu:
    WSL Ubuntu size

    Meanwhile the Debian uses:

    WSL Debian size

    Both configured the same way.

The installation of Debian is relatively simple, but it’s hard to find how to do it without the MS Store. That is one of the reasons for this article :)

Let’s get started!

  1. Open a CMD, but with a normal user, no admin rights required.
  2. Set WSL1 as a default:
    wsl.exe --set-default-version 1
  3. List all available distributions:
    wsl.exe --list --online
  4. If you want to install Debian, do so:
    wsl.exe --install -d Debian
  5. Set up your new user by entering your username (in lower case only!) and password twice.
  6. You’re in the Debian. Great! You’re almost done.
  7. Update your system by running:
    sudo apt update && sudo apt upgrade -y
  8. Remember to pin the icon to the taskbar:
  9. If you’d like to check the list of installed distributions, run this command in CMD:
    wsl.exe -l -v

Extra settings

From now on I will only write down what was important for me to get a usable system. You can use the system without these, but if you want to SSH to another machine from here, they will speed things up considerably.

  1. I don’t want to write an article on SSH config, there are good sites for that, e.g. this one. However, to get the TAB autocomplete to work, you need to put these up:
    sudo apt install openssh-client bash-completion
  2. To use sudo without password, the /etc/sudoers file must be edited:
    sudo nano /etc/sudoers
    And replace the line starting with «%sudo» with this:
    %sudo ALL=(ALL) NOPASSWD:ALL
  3. Use «magic» command as an ultimate updater, and add date to the history by editing
    nano /etc/bash.bashrc
    add to the bottom:
    alias magic='sudo apt update && sudo apt dist-upgrade --autoremove -y'
    HISTTIMEFORMAT="%Y-%m-%d %T "
  4. I like to scripting in ksh, so install it:
    sudo apt install ksh
  5. And I also use these tools:
    sudo apt install curl wget
  6. The systemd enabled by default. However, since I don’t use it, I disabled it to save resources:
    sudo nano /etc/wsl.conf

    And add these lines:
    [boot]
    systemd=false

This brief tutorial shows students and new users how to install and run Debian Linux on Windows Subsystem for Linux 2 (WSL2).

In 2017, Windows released Windows Subsystem for Linux that lets developers run a GNU/Linux environment, including most command-line tools, utilities, and applications directly in Windows without setting up a virtual machine or dual-boot.

WSL2 has since been released, an improvement over version 1. The new and improved version has a performance boost and complete system call compatibility. It is built with a new architecture that delivers features that make WSL a fantastic way to run a Linux environment in Windows.

To install WSL 2 on Windows 10, these two requirements must be met:

  • Windows 10 May 2020 (2004), Windows 10 May 2019 (1903), or Windows 10 November 2019 (1909) or later
  • A computer with Hyper-V Virtualization support

Installing Debian with WSL on Windows 11 is a great way to access a Linux environment without needing a separate virtual machine or dual-boot setup. With WSL, you can run Debian command-line utilities, including bash, ssh, git, apt, and many more, directly on your Windows 11 computer.

This can be useful for developers who need to work with Linux-based tools or anyone who wants to experiment with Linux without leaving the Windows environment. Additionally, WSL2, the latest version of WSL, provides enhanced performance and complete system call compatibility, making it an even better choice for running Linux on Windows.

Since you can now install Linux systems, including Debian, directly in Windows, let’s go ahead and install Debian. Before you can do that, you must enable WSL or WSL2 in Windows.

When you’re ready to enable WSL 2 on Windows 10, follow the steps below:

Enable WSL in Windows

To enable WSL in Windows, you will want to open the PowerShell terminal as administrator. Click on Start, then begin typing PowerShell.

Next, right-click the Windows PowerShell app and choose to run as administrator.

When the console opens, run the commands below:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

After installing, you should get a success message similar to the lines below:

Deployment Image Servicing and Management tool
Version: 10.0.19041.844

Image Version: 10.0.19042.844

Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.

Enable Virtual Machine Platform

WSL 2 requires Windows 10 Virtual Machine Platform to be enabled. This is not Hyper-V. To enable the VM platform feature in Windows, run the commands below from the same PowerShell administrator’s console.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

If you’re using Windows 10 version lower than 2004, then use the commands below:

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart

When you’re done running the commands above, restart your computer for all the configuration changes to apply. If you don’t restart, the below command might not be recognized.

After restarting your computer, log back in and launch PowerShell as administrator. Then, run the commands below to configure WSL 2 as the default version of WSL.

wsl --set-default-version 2

If you get an error about not having Linux kernel installed, get it from the link below and run it in Windows, then try the command above again.

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

Install Debian in Windows 10

Now that WSL 2 is installed and ready to be used, open the link below to download and install a copy of Debian from the Windows store.

Get Debian – Microsoft Store

Debian on Windows allows you to use Debian Terminal and run Debian command line utilities, including bash, ssh, git, apt, and many more.

Click the Get button and install. After installing Debian, you’ll want the option to launch Debian from the Windows WSL environment.

After downloading and installing, you will get a Launch button.

After launching Debian, it should install and prompt you to create your account.

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: richard
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
richard@DESKTOP-M1235UB:~$

That should do it!

Some troubleshooting commands to run when you run into issues.

wsl --set-default-version 1
bcdedit /set hypervisorlaunchtype auto start

Now, simply launch Debian from Windows and start by searching for it. You can also pin it to the taskbar and always have it launch from there.

That should do it!

Conclusion:

This post showed you how to install WSL 2 on Windows 10 and install Debian. If you find any error, please report it in the comment form below.

You can easily run a Linux distribution alongside your Windows setup thanks to Windows Subsystem for Linux (WSL). In this post, we’ll walk you through the simple process of setting up WSL and installing Debian on your Windows 11 machine.

Enable Windows Subsystem for Linux (WSL)

You can either enable it using GUI or command line

Via Windows Features GUI

Open Windows Features, check «Windows Subsystem for Linux» and accept.

Via command line

Open PowerShell or CMD as an administrator and run this command:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Enable Virtual Machine Platform

Run this command on the Powershell or CMD as an administrator:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Example output

C:\>dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Deployment Image Servicing and Management tool
Version: 10.0.22621.1

Image Version: 10.0.22621.2361

Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.

Restart the computer to apply the changes of the previous steps

Install WSL2

Enter the microsoft website by clicking this link, …

https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4—download-the-linux-kernel-update-package

… download the Linux kernel update package and install it:

C:\>wsl --set-default-version 2
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The operation completed successfully.

💡

If you run the Debian software before installing WSL2, you can come across this error below («Error: 0x800701bc WSL 2 requires en update to its kernel component»)

Install a Linux Distribution like Debian

Open Microsoft Store, search for «Debian» and and install it

Setup your Debian distribution

Launch Debian from the Start menu or by typing debian in the command prompt.

During the first launch, you’ll be prompted to create a new user and set a password.

That’s it! You can now enjoy the power of Linux alongside your Windows environment. Enjoy it!

Don’t hesitate to leave a comment!!

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

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Daemon tool for windows 7 32 bit
  • Windows показать размеры папок
  • Как скопировать фото с iphone на компьютер windows
  • Windows 10 рейтинг системы
  • Когда майкрософт перестал поддерживать windows 7