The Age-Old Struggle: Setting Up Local Test Environments Takes Way Too Long
Early in my career, whenever I needed to spin up a test cluster—like testing a two-node Docker Swarm or reproducing a bug specific to Ubuntu Server—it usually cost me an entire morning. Installing directly on my local dev machine risked cluttering the OS and causing runtime version conflicts. Downloading a 2.6GB ISO file and clicking endlessly through VirtualBox—tweaking RAM, configuring bridged networking, typing usernames and passwords—drained the energy right out of both me and my laptop after repeating it for just a few machines.
At home, I have a Proxmox homelab running over a dozen VMs. Even so, I can’t always sit next to my server or have a stable connection to VPN back home. Sitting at a coffee shop with my laptop, all I really need is a clean Ubuntu instance to test a quick 10-minute shell script and wipe it without a trace.
Where Do Common Solutions Fall Short?
Why is getting an isolated OS on a personal machine often such a hassle? Let’s take a look at the familiar tools:
- VirtualBox / VMware Workstation: Heavy GUI overhead (typically consuming at least 1.5–2GB of baseline RAM). Manual mouse clicks make it cumbersome to script and automate when you need to spin up multiple nodes.
- Vagrant: Great automation, but the
Vagrantfilecan be verbose and cumbersome. Pulling boxes for the first time is relatively slow, and bridged networking often breaks when VirtualBox updates. - WSL2 on Windows: Very convenient for daily CLI tasks. However, WSL2 shares the same kernel and network namespace with Windows behind an underlying NAT. When you need deep systemd testing, standalone UFW/iptables firewalls, or dedicated IP ranges for individual nodes, you’ll run into frustrating limitations.
- Docker: Containers share the host kernel. Docker cannot replace a full virtual machine when you need to test kernel modules, run systemd init from scratch, or simulate a completely isolated network environment.
Multipass: Canonical’s Lightweight Ubuntu VM Solution
Multipass is developed directly by Canonical (the parent company behind Ubuntu). Instead of forcing you through a manual ISO installation, it pulls official, ultra-lightweight Ubuntu Cloud Images. Multipass leverages native OS hypervisors: KVM on Linux, Hyper-V on Windows, and Hypervisor.framework on macOS. As a result, spinning up a VM and assigning an IP address takes only about 15 to 20 seconds.
1. Installing Multipass
On Linux (Ubuntu, Debian, Fedora, Arch)
Multipass is packaged natively via Snap. Open your terminal and run the following two commands:
sudo snap install multipass
multipass version
On Windows 10/11
The quickest way is using WinGet in PowerShell (running as Administrator):
winget install Canonical.Multipass
Multipass defaults to Hyper-V (which requires Windows Pro or Enterprise). If you’re on Windows Home, you can switch the backend driver to VirtualBox using multipass set local.driver=virtualbox.
2. Creating Your First Virtual Machine
No need to open any GUI windows. The entire workflow stays right in your terminal.
Spinning Up a VM with Custom Specs
To launch a VM running the latest Ubuntu LTS named dev-box, allocated with 2 CPU cores, 2GB RAM, and a 10GB disk:
multipass launch --name dev-box --cpus 2 --memory 2G --disk 10G
If you need to specify a particular release (such as 22.04 instead of the latest):
multipass launch 22.04 --name worker-node --cpus 1 --memory 1G --disk 8G
Checking VM List and IP Addresses
multipass list
The terminal will return the status along with internal IPv4 addresses:
Name State IPv4 Image
dev-box Running 10.147.214.45 Ubuntu 24.04 LTS
worker-node Running 10.147.214.88 Ubuntu 22.04 LTS
3. Working Inside the Virtual Machine
Direct Shell Access Without Setting Up SSH Keys
Multipass automatically maps the session to the default ubuntu user with sudo privileges:
multipass shell dev-box
When you want to return to the host machine, simply type exit.
Running Remote Commands Without SSH
If you just need to quickly install a package or check a port from the host machine, use the exec command:
multipass exec dev-box -- sudo apt update && sudo apt install -y nginx
multipass exec dev-box -- curl -I http://localhost
4. Mounting Code Directories Between Host and VM
You can open VS Code on the host machine to write code, then mount that directory directly into the VM to execute the runtime:
# Syntax: multipass mount <host-path> <vm-name>:<vm-path>
mkdir -p ~/my-project
multipass mount ~/my-project dev-box:/home/ubuntu/project
Any file edits in ~/my-project are instantly reflected inside the VM at /home/ubuntu/project without needing scp or rsync.
5. Saving State with Snapshots
Before running complex installation scripts or making deep changes to system configurations, take a snapshot as a safety net:
# Create a state snapshot
multipass snapshot dev-box --name clean-state
# Restore back to the previous state in seconds
multipass restore dev-box.clean-state
6. Cleaning Up Resources After Testing
Once you are finished, free up disk space and RAM with just three commands:
# Stop the VM during lunch breaks to save RAM
multipass stop dev-box
# Queue the VM for deletion
multipass delete dev-box
# Purge disk data permanently
multipass purge
Wrapping Up
Instead of wrestling with ISO files or network setups for 30 minutes, Multipass streamlines the workflow down to just four core actions: launch to get a clean environment, mount to bring in code, shell to test, and purge to clean up. It is a must-have tool in the terminal of any developer or DevOps engineer needing a fast, lightweight, and isolated Linux environment.
