( K3cs1 | 2023. 01. 15., v – 16:04 )

Szerkesztve: 2023. 01. 15., v – 16:07

Azért szeret kamuzni is ez az AI.

Azt a feladatot tűztem ki célul ma, hogy egy Windows 11 pro -ban WSL -en futó Debian -on futó nGinx kezdőlapja legyen elérhető a host Win 11 alól.

 

How to enable systemd in WSL debian under Windows 11 ?

 

2 / 2

To enable systemd in WSL Debian under Windows 11, you will need to install the systemd package and configure your WSL environment to use it as the init system. Here are the steps to do this:

  1. Start your WSL Debian terminal, and ensure that you have the latest updates by running the command: "sudo apt-get update" and "sudo apt-get upgrade"
  2. Install the systemd package by running the command: "sudo apt-get install systemd"
  3. Once the installation is complete, you will need to configure WSL to use systemd as the init system. To do this, open the /etc/wsl.conf file by running the command: "sudo nano /etc/wsl.conf"
  4. Add the following line to the file: "init= /usr/lib/systemd/systemd" and save the file.
  5. Restart your WSL environment by running the command: "wsl --shutdown"
  6. Start your WSL environment again and check that systemd is running by running the command: "systemctl"

You should now be able to use systemd commands such as "systemctl start" or "systemctl status" to manage services in your WSL Debian environment.

Note: Some older version of WSL may not support systemd, so please ensure that you have the latest version of WSL and Windows 11.

 

Valójában WSL Debian Win 11 alatt:

$ sudo systemctl start nginx
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

Az /etc/wsl.conf -os dolog blődség.

$ service nginx start    kellett csak amit kigugliztam.

 

A Windows tűzfal megnyitására irányuló kérésemre adott válasz jó volt. Adott egy PowerShell parancsot, amit lefuttatva kinyitotta a portot.