Cloud Computing 11 min read

Quickly Spin Up Ubuntu VMs on macOS with Multipass: A Step‑by‑Step Guide

This guide shows how to install Multipass on macOS, create and manage lightweight Ubuntu virtual machines using simple CLI commands, configure resources, mount volumes, transfer files, and automate setup with cloud‑init, providing a fast alternative to heavyweight virtualization tools for local development.

macrozheng
macrozheng
macrozheng
Quickly Spin Up Ubuntu VMs on macOS with Multipass: A Step‑by‑Step Guide

Looking for a lightweight way to run Ubuntu virtual machines on a Mac for learning Kubernetes, the author tried VMware, Parallels Desktop, and VirtualBox but faced issues, then discovered Multipass, an open‑source VM manager from Canonical.

What is Multipass?

Multipass is a lightweight VM manager that runs on Linux (using KVM), Windows (using Hyper‑V), and macOS (using HyperKit). It quickly creates Ubuntu instances with a single command and supports minimal overhead, making it suitable for local cloud‑like environments.

Installing Multipass on macOS

Download the installer from multipass.run or, if Homebrew is installed, run: brew cask install multipass Verify the installation:

multipass --version

Creating an Ubuntu VM

List available images: multipass find Launch a VM with custom resources (name, CPU, memory, disk): multipass launch -n vm01 -c 1 -m 1G -d 10G Available options:

-n, --name: VM name
-c, --cpus: number of CPU cores (default 1)
-m, --mem: memory size (default 1G)
-d, --disk: disk size (default 5G)

Managing the VM

List VMs

multipass list

Execute commands inside the VM

# multipass exec vm01 pwd
/home/ubuntu

Show VM information

multipass info vm01

Enter the VM shell

multipass shell vm01

Basic Operations Inside the VM

Set a root password and switch to the root user:

# sudo passwd
# su root

Update packages and install Nginx:

# apt-get update
# apt-get install nginx

Verify Nginx is running by opening http://192.168.64.2 in a browser on the host.

Mounting and Transferring Files

Mount a host directory into the VM (similar to Docker volumes):

# mkdir hello
# multipass mount /Users/moxi/hello vm01:/hello

Transfer a single file:

multipass transfer hello.txt vm01:/home/ubuntu/

Stopping, Deleting, and Purging VMs

# multipass start vm01
# multipass stop vm01
# multipass delete vm01   # marks for deletion
# multipass purge vm01   # permanently removes

Automating Setup with Cloud‑Init

Use the --cloud-init option to run a configuration file when the VM first boots:

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

Example config.yaml to install Node.js:

#cloud-config
runcmd:
  - curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
  - sudo apt-get install -y nodejs

Conclusion

Multipass offers a simple, Docker‑like experience for quickly provisioning Ubuntu VMs on macOS, making it an efficient tool for local development and testing of Linux‑based workloads.

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.

CLIDevOpsvirtual machinemacOSUbuntuCloud‑InitMultipass
macrozheng
Written by

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.

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.