Using Multipass to Create and Manage Ubuntu Virtual Machines
This article introduces Multipass, a lightweight cross‑platform virtual machine manager, and provides step‑by‑step instructions for installing it, launching Ubuntu instances, checking status, executing commands, and automating setup with cloud‑init, highlighting its usefulness for rapid development and testing environments.
Multipass is a lightweight, cross‑platform command‑line tool for creating and managing Ubuntu virtual machines. It runs on Linux, Windows, and macOS, offering a quick way to spin up disposable environments for development and testing.
Installation : Download the appropriate installer from the official website and install it on your operating system (the example uses Windows).
After installation, verify the version: $ multipass version Finding available Ubuntu images : $ multipass find The command lists various Ubuntu releases (e.g., 16.04, 18.04, 20.04, 20.10) along with their aliases.
Launching a new instance named dg: $ multipass launch --name dg The VM starts and you can confirm its details: $ multipass exec dg -- lsb_release -d Output shows the description, e.g., Ubuntu 18.04.4 LTS.
Managing the VM :
List running instances:
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
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 resume:
$ multipass stop dg
$ multipass start dgDelete and purge:
$ multipass delete dg
$ multipass purge dgAutomating setup with cloud‑init : Use the --cloud-init flag to apply a 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 provision tools automatically.
Conclusion : Multipass provides a fast, low‑overhead way to create Ubuntu VMs for experiments, small database clusters, or any scenario where a reproducible environment is needed. Its limitation is that it only supports Ubuntu images, as it is maintained by Canonical.
For more information, visit the official site https://multipass.run/ and the documentation https://multipass.run/docs/ .
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.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
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.
