Uživatelské nástroje

Nástroje pro tento web


private:poznamky:windows:wsl

Windows Subsystem for Linux

Instalace WSL a Linux distribuce

Instalace WSL

Instalace Linux Distribuce - Debian

Instalace z Microsoft Store

Základní konfigurace

  1. nový uživatel - winbck
  2. aktualizace pod účtem root

Nastavení default uživatele
https://www.tenforums.com/tutorials/128152-set-default-user-windows-subsystem-linux-distro-windows-10-a.html

  sudo su -
  apt update
  apt upgrade
  apt install vim rsync ssh

SSH

port 2210

Automatické spuštění ssh služby

https://gist.github.com/dentechy/de2be62b55cfd234681921d5a8b6be11#how-to-automatically-start-ssh-server-on-boot-on-windows-subsystem-for-linux

sudoers
%sudo ALL=NOPASSWD: /etc/init.d/ssh start

Put to the shell:Startup folder bat file with the content:

ssh.bat
powershell.exe "& 'C:\Windows\System32\bash.exe' -c 'sudo /etc/init.d/ssh start'"

Start WSL - bez přihlášení - no login

Start WSL on boot without login
https://www.reddit.com/r/bashonubuntuonwindows/comments/1716np4/start_wsl_on_boot_without_login/

I found that you have to keep a WSL session (started by wsl.exe, some process that's invoked by SessionLeader in pstree) running, otherwise WSL simply quits after some time.

My solution (WSL2 on Windows 11):

(optional) enable systemd in /etc/wsl.conf (for starting various services automatically, such as sshd, cron, rsyslogd, etc.)

get nircmd fom https://www.nirsoft.net/utils/nircmd.html

write a batch which has: @start /b \path\to\nircmd.exe execmd wsl ~

Use Task Scheduler to start the batch (when system starts)

Problém se spuštěním nainstalované distribuce

Po spuštění nového terminálu příksazem bash se objeví hláška „No installed distributions when there are indeed distros installed“

Pomohlo zastavit a znovu spustit službu pod kterou běží WSL.

net stop LxssManager
net start LxssManager

Ověření nainstalované distribuce

wslconfig /list /all

Windows Subsystem for Linux Distributions:
Debian (Default)

Calling a PowerShell Script from WSL

Windows 11

Kromě funkce WSL je potřeba zapnout funkci Platforma virtuálního počítače

To fix the WSL install error 0x80370114

https://github.com/Microsoft/WSL/issues/3054#issuecomment-705991287

WSL - systemd

private/poznamky/windows/wsl.txt · Poslední úprava: autor: snemec

DokuWiki Appliance - Powered by TurnKey Linux