Local Community

Local on WSL2 on Windows 11 is Far more performant than native

This is splitting out of an earlier thread on the subject that got bogged down in difficulties reporoducing the environment. Below are the verified instructions. This change brought local load time from 5+sec to < 500ms.

In an effort to reproduce my earlier instructions which, obviously, ceased to work on later versions of WSL2, I’ve tracked down the problem to policykit (specifically pkexec) being unable to pop up the GUI sudo box on WSL2, as is required by LocalWP. The earlier instructions used systemd-genie to fix this dbus/policykit/WSL2 issue. That no longer working, I was able to resolve the issue by creating a stub to an alternative GUI sudo utility which Local will use in its place.

Here are the full instructions to get LocalWP running under the latest version of WSL2 Debian on Windows 11 (I haven’t tried Ubuntu):

Install dependencies:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get -y install libaio1 libncurses5 libnss3-tools rsync shared-mime-info desktop-file-utils libxshmfence1 libglu1 libatk1.0-0 libatk-bridge2.0-0 libgtk2.0-0 libgtk-3-0 libgbm-dev libasound2 libnuma-dev libxslt1.1 lxqt-sudo libzip4
sudo apt --fix-broken install
curl -O http://snapshot.debian.org/archive/debian/20190501T215844Z/pool/main/g/glibc/multiarch-support_2.28-10_amd64.deb
sudo dpkg -i multiarch-support_2.28-10_amd64.deb
curl -O http://snapshot.debian.org/archive/debian/20141009T042436Z/pool/main/libj/libjpeg8/libjpeg8_8d1-2_amd64.deb
sudo dpkg -i libjpeg8_8d1-2_amd64.deb
sudo cp /usr/lib/x86_64-linux-gnu/libonig.so.5 /usr/lib/x86_64-linux-gnu/libonig.so.4

Install LocalWP:

sudo dpkg -i local-6.4.3-linux.deb

LocalWP fixes:

sudo setcap 'cap_net_bind_service=+ep' /opt/Local/resources/extraResources/lightning-services/nginx-1.16.0+6/bin/linux/sbin/nginx

sudo nano /usr/bin/kdesudo and set to:

/usr/bin/lxqt-sudo $7
sudo chmod +x /usr/bin/kdesudo

Miscellanous fixes:

If you want the site domain accessible from Windows, sudo nano /mnt/c/Windows/system32/drivers/etc/hosts and add SITENAME.local

If you want the site to open from LocalWP into Windows Chrome:

sudo update-alternatives --install "/bin/host_chrome" "chrome" "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" 1

and add export BROWSER=host_chrome to ~/.bashrc

Now you can pull your site, sit back, and make a cup of coffee.