Setting up WSL2 + Ubuntu for PHP & Laravel Development
Setting up Ubuntu/Linux in Windows for Development
Developing on Windows used to mean dealing with constant environment discrepancies. Fortunately, the Windows Subsystem for Linux (WSL2) paired with Ubuntu completely changes the game. Furthermore, it gives you a native Linux environment without ever leaving Windows. Here is how you can get it configured step-by-step.
First, open PowerShell as Administrator and run the installation command to kick off the process:
wsl --install -d Ubuntu
This command sets up the Virtual Machine Platform, installs WSL, and downloads Ubuntu seamlessly. Additionally, you will need to reboot your system once it finishes.
Resolving Common Installation Errors (0x80370114)
Sometimes, launching Ubuntu from the Start menu triggers an unexpected startup error:
Typically, this error means the Virtual Machine Platform or hardware virtualization is disabled. To check your current feature status, execute these commands in PowerShell as Administrator:
dism.exe /online /get-featureinfo /featurename:VirtualMachinePlatform
dism.exe /online /get-featureinfo /featurename:Microsoft-Windows-Subsystem-Linux
If either feature shows as disabled, enable them immediately by running:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
After executing those commands, make sure you reboot your computer.
Creating Your Unix User Account
Once your system reboots and Ubuntu launches successfully, the terminal will prompt you to create your default Unix user account:
Simply enter your desired username, create a secure password, and select your telemetry preferences.
You are now completely ready to install PHP, Composer, and Laravel inside your brand new WSL2 environment!
Join the Newsletter
Sign up for our personalized daily newsletter





Leave a Reply