Multipass: Lightweight Free VM Tool for Rapid Ubuntu Instances
This tutorial introduces Multipass, a free command-line tool from Canonical for quickly creating and managing Ubuntu virtual machines on Linux, Windows, and macOS, covering installation, VM lifecycle commands, cloud-init automation, and a comparison with VMware.
Introduction
VMware is a powerful virtual machine tool but requires a paid license. Multipass, developed by Canonical (the company behind Ubuntu), is a free, lightweight, cross-platform command-line utility for managing Ubuntu virtual machines on Linux, Windows, and macOS.
Installation
Download the installer for your operating system from the official website https://multipass.run/ and install it. Verify the installation:
$ multipass versionFinding Available Ubuntu Images
List the available Ubuntu images and aliases:
$ multipass findSample output:
Image Aliases Version Description
snapcraft:core18 20201111 Snapcraft builder for Core 18
snapcraft:core20 20201111 Snapcraft builder for Core 20
core core16 20200818 Ubuntu Core 16
core18 20200812 Ubuntu Core 18
16.04 xenial 20210128 Ubuntu 16.04 LTS
18.04 bionic 20210129 Ubuntu 18.04 LTS
20.04 focal,lts 20210223 Ubuntu 20.04 LTS
20.10 groovy 20210209 Ubuntu 20.10
appliance:adguard-home 20200812 Ubuntu AdGuard Home Appliance
appliance:mosquitto 20200812 Ubuntu Mosquitto Appliance
appliance:nextcloud 20200812 Ubuntu Nextcloud Appliance
appliance:openhab 20200812 Ubuntu openHAB Home Appliance
appliance:plexmediaserver 20200812 Ubuntu Plex Media Server ApplianceCreating and Inspecting a Virtual Machine
Launch a new instance named dg (defaults to the latest LTS):
$ multipass launch --name dg
Launched: dgCheck the Ubuntu version inside the VM:
$ multipass exec dg -- lsb_release -d
Description: Ubuntu 18.04.4 LTSManaging Virtual Machines
List Running VMs
$ multipass list
Name State IPv4 Image
dg Running 192.168.24.5 Ubuntu 18.04 LTSShow Detailed VM Information
$ 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.7MAccess the VM Shell
$ multipass shell dgAlternatively, run single commands without entering the shell using multipass exec.
Stop, Start, Delete, and Purge
# Stop
$ multipass stop dg
# Start
$ multipass start dg
# Delete (keeps data)
$ multipass delete dg
# Purge (permanently remove)
$ multipass purge dgAutomating VM Initialization with cloud-init
Use a cloud-init configuration file to run commands on first boot. Example 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.debLaunch a VM with this configuration:
$ multipass launch --name ubuntu --cloud-init config.yamlThe runcmd section specifies commands to execute during the first boot.
Summary
Multipass excels at quickly spinning up Ubuntu VMs for ad-hoc Linux experiments or local cluster testing. Its command-line workflow is fast and scriptable. The main limitation is that it only supports Ubuntu images because it is developed by Canonical.
References
Official website: https://multipass.run/
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.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
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.
