Open up powershell and run the following command to install, and upgrade WSL:
wsl --install
wsl --update Ubuntu 2
P81 does not support IPV6, and struggles to resolve DNS on the VPN when using the VPN Interface's DNS. If we do not change these settings DNS resolution will take significantly longer when connected to VPN.
- Disable IPV6 as P81 doesn't support it currently
- In powershell, run the following:
Set-Content -Path "$env:userprofile/.wslconfig" -Value @" [wsl2] kernelCommandLine=ipv6.disable=1 "@
- Configure P81 to use VPN Interface DNS
- Open P81
- Select settings
- Toggle "Use VPN Interface DNS" setting off
WSL Images can be created from Docker Images. Here we pull down the latest Rocky 9 Image, extract it, and import it into WSL.
In Powershell run the following:
mkdir C:\wsl\rocky
iwr -OutFile C:\wsl\Rocky-9.tar.xz -Uri https://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-Container-Base.latest.x86_64.tar.xz
wsl --import Rocky C:\wsl\rocky\ C:\wsl\Rocky-9.tar.xz --version 2
Now that we have imported the image, we can finish setting things up inside the WSL image.
From Powershell run wsl -d Rocky
to open a bash shell inside Rocky.
Inside the bash shell, run the following commands to setup your user inside WSL:
dnf update -y && dnf install passwd sudo git wget -y
USERNAME=$(cmd.exe /c "echo %USERNAME%" |sed 's/[^[:alpha:]]/_/g;s/[[:upper:]]/\L&/g;s/_$//')
adduser -G wheel $USERNAME
echo -e "[user]\ndefault=$USERNAME" >> /etc/wsl.conf
echo -e "[automount]\noptions=\"metadata\"" >> /etc/wsl.conf
passwd $USERNAME
exit
You should now be back at your Powershell prompt. From here we will restart the WSL image so the changes take effect.
Run the following command:
wsl --terminate Rocky
Now, when you start WSL Rocky image you should be running as your own user:
PS C:\Users\Charlie Jones> wsl -d Rocky
/mnt/c/Users/Charlie Jones
❯ whoami
charlie_jones