Bỏ qua để đến nội dung
Windows with WSL2 (beta) Run the MZPanel agent inside WSL2 on Windows 10/11 — install Ubuntu 24.04, enable systemd in /etc/wsl.conf, size the VM with .wslconfig, start WSL at logon with a scheduled task, keep the PC awake, and install with the homelab profile.

Windows with WSL2 (beta)

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

A Windows PC (for example a gaming PC with a big GPU) can join your fleet through WSL2, the Linux VM built into Windows. MZPanel runs inside the Linux distro; it never touches Windows. This path is beta: it works, but WSL was made for development, so the box goes offline whenever Windows sleeps, restarts or stops WSL. MZPanel expects that from a homelab box and sends no offline alerts.

In PowerShell as administrator (Windows 11, or Windows 10 22H2):

Terminal window
wsl --install -d Ubuntu-24.04
wsl --update
wsl -l -v # Ubuntu-24.04 must show VERSION 2

Open Ubuntu 24.04 from the Start menu once and create your Linux user.

The agent is a systemd service. Inside Ubuntu:

Terminal window
sudo tee /etc/wsl.conf >/dev/null <<'EOF'
[boot]
systemd=true
EOF

Then in PowerShell: wsl --shutdown, and open Ubuntu again. Check:

Terminal window
ps -p 1 -o comm= # systemd
systemctl is-system-running # running (or degraded: fine)

The installer stops with a pointer back here if systemd is not running.

By default WSL2 takes up to half of the PC’s RAM and stops the VM when it is idle. Create %UserProfile%\.wslconfig (for example C:\Users\you\.wslconfig):

[wsl2]
memory=8GB
processors=4
swap=4GB
# Windows 11 22H2+: share the PC's network, so LAN devices reach the box's apps
networkingMode=mirrored

Run wsl --shutdown after every change. networkingMode=mirrored is only needed for LAN-only URLs; the Cloudflare Tunnel works without it (it dials out).

WSL stops the distro a few seconds after the last Linux process outside systemd exits. A scheduled task that starts at logon and keeps one process alive solves both. In PowerShell (as your normal user, not administrator):

Terminal window
$action = New-ScheduledTaskAction -Execute "wsl.exe" -Argument "-d Ubuntu-24.04 --exec /bin/sh -c 'exec sleep infinity'"
$trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit ([TimeSpan]::Zero) -Hidden
Register-ScheduledTask -TaskName "WSL keepalive (MZPanel)" -Action $action -Trigger $trigger -Settings $settings

The task runs when you sign in. After a Windows restart the box comes back once someone signs in, so enable automatic sign-in if the PC must recover on its own (Windows settings > Accounts > Sign-in options, or Sysinternals Autologon).

In PowerShell as administrator:

Terminal window
powercfg /change standby-timeout-ac 0
powercfg /change hibernate-timeout-ac 0
powercfg /change monitor-timeout-ac 15

On a laptop also set Lid close action: Do nothing (on AC power) and keep it plugged in. Set Windows Update > Active hours so updates do not restart it at a bad time.

Use the command from Servers > Add server and add MZ_PROFILE=homelab:

Terminal window
curl -fsSL https://get.mzpanel.com | sudo INSTALL_TOKEN=<install-token> MZ_PROFILE=homelab bash

The homelab profile installs Docker Engine inside the distro. Do not use Docker Desktop’s WSL integration for the same distro at the same time: two engines on one distro conflict.

WSL2 uses the Windows NVIDIA driver: install the normal Windows driver (no Linux driver in the distro), then the NVIDIA Container Toolkit inside Ubuntu. nvidia-smi must work inside the distro before containers can use the GPU.

SymptomFix
Installer: “systemd is not running in this WSL distro”step 2, then wsl --shutdown
Installer: “This machine looks like a personal computer”add MZ_PROFILE=homelab
Box offline after you close the terminalthe keepalive task (step 4) is missing or disabled
TLS or token errors after the PC sleptthe distro clock drifted: sudo hwclock -s, or restart WSL
LAN devices cannot open http://<app>.home.arpanetworkingMode=mirrored (step 3), and allow the port in Windows Defender Firewall