Multipass: Create Ubuntu VMs in 30 Seconds – The Ultimate VirtualBox Alternative

Virtualization tutorial - IT technology blog
Virtualization tutorial - IT technology blog

2 AM and the VirtualBox Nightmare

A familiar scenario: A production server throws a strange error in the middle of the night. You urgently need a clean Ubuntu environment to reproduce the bug, but your personal machine runs Windows. Open VirtualBox? You have to wait for it to load, select the ISO file, configure RAM and CPU, and then wait for the OS installation. That’s at least 15 precious minutes wasted. Too slow when every second costs money.

That’s why I switched entirely to Multipass. It’s a tool built by Canonical (the team behind Ubuntu). With just a single command, you have a virtual machine ready. It’s extremely lightweight because it leverages the operating system’s native hypervisors like Hyper-V (Windows), HyperKit (macOS), or KVM (Linux). Instead of heavy hardware emulation, Multipass runs almost directly on host resources.

I run a homelab with Proxmox managing 12 VMs. However, for quickly testing a script or an Nginx configuration, I always choose Multipass right on my laptop. Here is how you can master this tool.

Quick Start: A Virtual Machine in the Blink of an Eye

Forget clicking around. Everything in Multipass happens in the terminal at lightning speed.

1. Simple Installation

  • macOS: brew install --cask multipass
  • Windows: Use choco install multipass or download the installer from the homepage.
  • Linux: sudo snap install multipass

2. Initialize Your First VM

Open Terminal/PowerShell and type exactly one command:

multipass launch --name dev-box

Multipass will automatically download the latest Ubuntu LTS image and configure the resources. With a stable internet connection, this process takes less than 60 seconds.

3. Access the Shell

multipass shell dev-box

Now you’re inside the Ubuntu environment. You are free to experiment with configurations. If you accidentally break something? Deleting and recreating it only takes another 30 seconds.

Why is Multipass Preferred by DevOps?

Many IT beginners choose VirtualBox for its Graphical User Interface (GUI). But in reality, an OS GUI just wastes RAM and CPU. Multipass eliminates all that unnecessary clutter.

  • Boot Speed: A Multipass VM is ready to work in about 15-20 seconds. This usually takes 2-3 minutes in VirtualBox.
  • Resource Efficiency: Multipass only consumes about 20-30MB of RAM for background processes when no VMs are running.
  • Automation: Support for Cloud-init allows you to pre-install Docker, Git, or Node.js as soon as the machine boots.

Customizing for Real-World Needs

Default configurations are usually quite modest. When you need to run heavy applications like a mini Kubernetes cluster, you should specify resources explicitly.

Allocating RAM and CPU

For example, to create a powerful VM with 2 CPUs, 4GB RAM, and 20GB of disk space:

multipass launch --name k8s-node --cpus 2 --memory 4G --disk 20G

Sharing Data Between Host and VM

This is the “killer feature.” You can code in VS Code on your host machine but execute it in a standard Linux environment:

# Mount the project directory into the VM
multipass mount ./my-project dev-box:/home/ubuntu/project

Using Cloud-init for Automated Setup

Don’t waste time typing apt update manually. Prepare a cloud-config.yaml file:

#cloud-config
packages:
  - docker.io
  - curl
runcmd:
  - systemctl start docker

Then launch it with the configuration file:

multipass launch --name auto-docker --cloud-init cloud-config.yaml

Managing and Cleaning Up the System

Don’t let old VMs hog your laptop’s resources. Remember these cleanup commands:

  • multipass list: View the list of running VMs.
  • multipass stop dev-box: Stop the VM to save battery.
  • multipass delete dev-box: Move the VM to the trash.
  • multipass purge: Permanently delete and reclaim all disk space.

Pro Tips from the Field

After using Multipass for a long time as a replacement for heavy solutions, I’ve gathered a few tips:

  1. Check the IP: The VM’s IP might change after you restart the host machine. Use multipass info dev-box to get the latest IP before configuring SSH.
  2. Leverage Aliases: You can run commands inside the VM directly from the host terminal. For example: multipass alias dev-box:ls my-ls. Then just type multipass my-ls.
  3. Test Older Versions: If you need to test an app on Ubuntu 20.04, type multipass find to see the list of supported images.

Multipass wasn’t designed to completely replace dedicated virtualization systems like Proxmox. However, as a sandbox for rapid development and testing, it is truly unrivaled. If you’re tired of VirtualBox’s sluggishness, try Multipass today. Saving 15 minutes every time you create a VM will help you stay focused on fixing bugs.

Share: