#
What is this?
VirtualBox WSL2 is a new way to have a WSL2-like environment, with some benefits (and some drawbacks, of course) that a normal WSL2 installation doesn't have.
Overall, it gives you more control over your VM resources, location, behavior, and allows you to use any distro, keeping it clean, and using GUI-based apps (X or Wayland) without much hassle. There's also automatic port forward towards localhost
included with a small PowerShell v7 script.
The guide may seem lengthy, but it's just some basic steps:
- Create a VM
- Install a distro
- Enable automatic SSH port forward
- Edit a couple files and update your distro
- Install the VirtualBox Guest Additions
- Set up the automatic port forward script
And that's it! While it isn't as automatic as running wsl --install
, it's more powerful and it can be done in a couple hours max.
One of the major benefits of this is that you don't need to upgrade to Windows 11 (although, highly recommended) or even an updated Windows 10 to achieve the same thing. As long as you can run VirtualBox and PowerShell, it'll work! Of course, you could replicate the PowerShell script with bash or something else, and that'll make the solution possible to be run in other operating systems as well. If you do so, I encourage you to submit your version to the GitHub repo hosting this guide, so we all can benefit from it 😊.
Ready? Let's get started!
Note
If you prefer a video tutorial, there's one in the works. Stay tuned! 😁