MENU

解决wsl2不支持systemd管理服务的问题

November 29, 2021 • linux相关,Windows

ubuntu-wsl2-systemd-script(适用ubuntu)

sudo apt install git
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh

genie(适用arch/manjaro/centos等)

yay dotnet
yay -S genie-systemd

ubuntu使用国内源

sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo apt update -y

启用适用于 Linux 的 Windows 子系统

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

启用虚拟机功能

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

下载 Linux 内核更新包

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