This project is still WIP. Errors can happen every now and then.
- Install clean wsl instance (ubuntu)
- Login into wsl2 (
wsl
orwsl -d distro-name
) and execute:sudo apt-get update sudo apt-get upgrade sudo apt-get install git git clone [email protected]:fliespl/wsl2-ubuntu20.04-ansible.git cd wsl2-ubuntu20.04-ansible
- Setup vars in vars/ directory from .dist's
- Run playbook
ansible-playbook local.yml
- Add to Windows hosts file:
192.168.50.16 pma.wsl phpinfo7.4.wsl phpinfo8.0.wsl mailhog.wsl
so you can access various services via domain- change IP if you used something else in vars file
- Make sure following options are set in .wslconfig in C:\Users<USER>.wslconfig
[wsl2]
localhostForwarding=false
guiApplications=false # do not set if you want to use builtin wslg
swap=0 # recommended
- Run
wsl
orwsl -d distro-name
- Setup static IP (only required once per Windows reboot):
- Start elevated powershell - right click start menu "Windows PowerShell (Admin)"
- Execute
New-NetIPAddress -InterfaceAlias "vEthernet (WSL)" -AddressFamily IPv4 -IPAddress 192.168.50.88 -PrefixLength 24
- Check
ping 192.168.50.16
from Windows machine
- Run
PowerShell.exe -ExecutionPolicy ByPass -Scope LocalMachine
- Execute
setup_wsl_ip.bat
to assign static IP on Windows host for WSL interface. - Import two jobs from task-scheduler directory into Windows Task Scheduler:
- On General tab: Update "When running the task, use the following user account: " to your account
- On Actions tab: Update .bat file location
- If needed - update startup_script.bat with your distro name + wsl.exe path
- Restart Windows to check if everything goes up correctly.
ping 192.168.50.16
to check if WSL machine responds.- Check if task scheduler jobs are setup correctly (user + .bat files locations) - i.e. close WSL and trigger them manually from task scheduler.