Windows: Virtualisation and Running Linux

A short note on virtualisation for Linux applications and machines on your Windows machine.

There are at least 3 ways that you can run Linux (and other operating systems) on your Windows machine. I recently went through settings these up:

  1. Oracle VirtualBox: this lets you run a full-fledged virtual machine (running any supported operating system) on your Windows machine as a host. I am currently using it to run Ubuntu Server 24.04.1 LTS as the base operating system with the XUbuntu Desktop. This gives you a full environment with networking, GUI, etc. to run as a virtualised machine. You can install applications, etc. as you would on a normal Ubuntu Linux machine. I am running this with 4GB RAM (current use shows approx. 1GB RAM when no browser is running) and 20GB of storage. If you’re using VSCode, the first time you run it after installing WSL2, you will be prompted to install a VS Code extension to make it easier to work with WSL2.
  2. Windows Subsystem for Linux: Windows 10 introduced Windows Subsystem for Linux and that was later enhanced as WSL2 to provide even better support and performance. WSL2 is also used as one of the requirements for running Linux containers on Windows (next). I have this also set up with Ubuntu 24.04 (as reported by doing lsb_release -a in the terminal). Since its from Microsoft, it should normally work and this time, I found it much easier than the last time when I ran into a number of problems getting it to work due to my set up. Also, this post is a good read for installation and remember to keep the basic reference of the WSL commands at hand. The WSL FAQ on the Microsoft Learn website is also extremely helpful.
  3. Containers: The final approach is to use containers. This approach was popularised by Docker and a number of alternative desktop managers for containers and images sprung up when Docker changed its licensing model. After not using containers for a very long time, I finally set up Podman Desktop from Redhat for running containers. I found it to relative pain free to set up Podman Desktop on Windows though it needed WSL2 to be enabled. Take a look at the other post on this site about setting up Podman and running through the first few steps.

Of course, there are options for each of these. You might want to use Windows Hyper-v or QEmu for virtual machines, or Docker Desktop (be aware of licensing requirements)/ Rancher Desktop instead of Podman Desktop.

Remember that each of these options takes space, CPU and memory. So, keep an eye out when you start running low. You can choose where the virtual machine disks are created for Oracle VirtualBox in case you don’t have enough space on your system drive. For Podman Desktop, keep an eye on the C:\Users\[USER_NAME]\.local\share\containers\podman\machine\wsl\wsldist folder to see the disk space usage. There are ways to move the machines away (e.g., as discussed in this stack overflow post if you need to.

Once it’s all working nicely, you might see something like this.

Honestly, Windows does get a bad rap, but it’s quite cool that all this actually works. As I get deeper into these again, I am sure that I will run into common issues, e.g., with networking, etc. and so I expect to to add more information on this site. Stay tuned!

Feel free to connect with me as @onghu on Twitter or on Mastodon as @onghu@ruby.social or @onghu.com on Bluesky to discuss more, or leave a comment below.