Operations 6 min read

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.

Code Ape Tech Column
Code Ape Tech Column
Code Ape Tech Column
How to Quickly Set Up Ubuntu VMs with Multipass: A Step‑by‑Step Guide

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 version

Create an Ubuntu VM

List available Ubuntu images: $ multipass find Launch a new instance named dg:

$ multipass launch --name dg
Launched: dg

Verify the Ubuntu version inside the VM:

$ multipass exec dg -- lsb_release -d
Description:    Ubuntu 18.04.4 LTS

Manage the VM

List VMs

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
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.7M

Enter the VM shell $ multipass shell dg Pause and restart

# Pause
$ multipass stop dg
# Start
$ multipass start dg

Delete and purge

# Delete (marks for removal)
$ multipass delete dg
# Purge (removes completely)
$ multipass purge dg

Automate Configuration

Use --cloud-init with a YAML file to run commands on first boot:

$ multipass launch --name ubuntu --cloud-init config.yaml

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.deb

Conclusion

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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Virtual MachineUbuntuCloud‑InitMultipass
Code Ape Tech Column
Written by

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

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.