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 versionFinding available Ubuntu images :
$ multipass findThe 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 dgThe VM starts and you can confirm its details:
$ multipass exec dg -- lsb_release -dOutput 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 LTS
Show 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.7M
Enter the VM shell: $ multipass shell dg
Pause and resume: $ multipass stop dg $ multipass start dg
Delete and purge: $ multipass delete dg $ multipass purge dg
Automating 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/ .
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.