WSL2 installation systemd method

Make sure systemd is enabled on WSL 2 distributions.

1. Download and run the latest installer script .

curl -L -O "https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh"
chmod +x install.sh
sudo ./install.sh install

This script installs the distribution, but does not enable it yet.

2. Enable Distrod in the distribution

You have two options. If you want to start Distrod automatically when Windows starts, enable Distrod with the following command

/opt/distrod/bin/distrod enable --start-on-windows-boot

otherwise

/opt/distrod/bin/distrod enable

You can run with again if you want to enable autostart later. enable --start-on-windows-boot

3. Restart the distro

Close WSL's terminal. Open a new Command Prompt window and run the following command.

wsl --terminate Distrod

After reopening a new WSL window, the shell will run in the systemd session.

After the installation is complete, you can run the following command to query

systemctl status | cat

Guess you like

Origin blog.csdn.net/u013431141/article/details/128617384