How to Quickly Set Up Ubuntu VMs with Multipass: A Step‑by‑Step Guide
This tutorial walks you through installing Multipass, checking its version, listing available Ubuntu images, launching and managing Ubuntu virtual machines, and automating configuration with cloud‑init, providing all essential commands for efficient local VM workflows.
Multipass
Multipass is a lightweight command‑line tool for managing virtual machines on Linux, Windows, and macOS.
Getting Started
Download and install Multipass for your operating system (the example uses Windows).
After installation, check the version:
$ multipass versionCreate an Ubuntu VM
List available Ubuntu images: $ multipass find Launch a new instance named dg:
$ multipass launch --name dg
Launched: dgVerify the Ubuntu version inside the VM:
$ multipass exec dg -- lsb_release -d
Description: Ubuntu 18.04.4 LTSManage the VM
List VMs
Name State IPv4 Image
dg Running 192.168.24.5 Ubuntu 18.04 LTSShow detailed info
$ multipass info --all
Name: dg
State: Running
IPv4: 192.168.24.5
Release: Ubuntu 18.04.4 LTS
Image hash: fe3030933742 (Ubuntu 18.04 LTS)
Load: 0.00 0.00 0.00
Disk usage: 1.5G out of 4.7G
Memory usage: 112.1M out of 985.7MEnter the VM shell $ multipass shell dg Pause and restart
# Pause
$ multipass stop dg
# Start
$ multipass start dgDelete and purge
# Delete (marks for removal)
$ multipass delete dg
# Purge (removes completely)
$ multipass purge dgAutomate Configuration
Use --cloud-init with a YAML file to run commands on first boot:
$ 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.debConclusion
Multipass provides a fast way to spin up Ubuntu VMs for testing, small database clusters, or other Linux experiments. Its limitation is that it only supports Ubuntu images, as it is developed by Canonical.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Code Ape Tech Column
Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn
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.
