How to Quickly Spin Up Ubuntu VMs with Multipass: A Step‑by‑Step Guide
This article walks you through installing Multipass, launching and managing Ubuntu virtual machines on Windows, macOS, or Linux, covering commands for version checking, image selection, VM creation, inspection, shell access, pause/restart, deletion, and automated cloud‑init configuration.
Multipass Overview
Multipass is a lightweight command‑line tool for managing virtual machines across Linux, Windows, and macOS. It offers a simple way to create, run, and control Ubuntu instances without the cost of commercial solutions like VMware.
Installation
Download the appropriate installer from the official Multipass website and install it on your operating system (the example uses Windows). $ multipass version Running the above command shows the installed version.
Creating an Ubuntu VM
First, list available Ubuntu images: $ multipass find The command returns a table of image aliases and versions, such as 16.04, 18.04, 20.04, etc.
Create a new instance named dg: $ multipass launch --name dg The VM starts automatically. Verify the instance:
Name State IPv4 Image
dg Running 192.168.24.5 Ubuntu 18.04 LTSInspecting the VM
Show detailed information about the running VM: $ multipass exec dg -- lsb_release -d Output:
Description: Ubuntu 18.04.4 LTSAccessing the VM
Open an interactive shell inside the instance: $ multipass shell dg If you prefer not to enter the shell, you can execute commands directly with multipass exec.
Pausing and Restarting
# Pause
$ multipass stop dg
# Restart
$ multipass start dgDeleting and Purging
# Delete (marks for removal)
$ multipass delete dg
# Purge (removes completely)
$ multipass purge dgAutomating Configuration with Cloud‑Init
Use the --cloud-init flag to apply an initial configuration file when launching a VM:
$ multipass launch --name ubuntu --cloud-init config.yamlExample config.yaml:
#cloud-config
runcmd:
- curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
- sudo apt-get install -y nodejs
- wget https://releases.leanapp.cn/leancloud/lean-cli/releases/download/v0.21.0/lean-cli-x64.deb
- sudo dpkg -i lean-cli-x64.debThe runcmd section runs these commands on first boot, allowing you to pre‑install tools such as Node.js and the LeanCloud CLI.
Conclusion
Multipass provides a fast, cost‑free way to spin up Ubuntu environments for testing, small database clusters, or any Linux‑based experiment. Its limitation is that it only supports Ubuntu images, as it is developed by Canonical.
Related Links
Official site: https://multipass.run/
Documentation: https://multipass.run/docs/
Architect's Tech Stack
Java backend, microservices, distributed systems, containerized programming, and more.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
