How to Quickly Spin Up Ubuntu VMs with Multipass: A Step‑by‑Step Guide
This guide introduces Multipass, a lightweight cross‑platform VM manager, and walks through installing it, launching Ubuntu instances, checking status, accessing shells, and automating setup with cloud‑init, while also covering pause, restart, and deletion commands.
While VMware is a well‑known VM tool, it requires a paid license; Multipass offers a free, lightweight alternative that runs on Linux, Windows, and macOS.
Multipass
Multipass is a lightweight command‑line VM management tool that simplifies creating and managing Ubuntu instances.
Getting Started
Download and install Multipass from the official website for your operating system (example shown for Windows).
After installation, verify the version:
<code>$ multipass version</code>Create an Ubuntu VM
List available Ubuntu images:
<code>$ multipass find</code>The command returns a table of images, such as core18, core20, 16.04, 18.04, 20.04, etc.
<code>Image Aliases Version Description</code>Launch a new container named dg :
<code>$ multipass launch --name dg
Launched: dg</code>Check the Ubuntu version inside the VM:
<code>$ multipass exec dg -- lsb_release -d
Description: Ubuntu 18.04.4 LTS</code>Managing the VM
List VMs after creation:
<code>Name State IPv4 Image
dg Running 192.168.24.5 Ubuntu 18.04 LTS</code>The VM is running with IP address 192.168.24.5.
Enter the VM shell :
<code>$ multipass shell dg</code>Alternatively, use multipass exec for one‑off commands.
Pause / restart :
<code># pause
$ multipass stop dg
# start
$ multipass start dg</code>Delete / purge :
<code># delete
$ multipass delete dg
# purge
$ multipass purge dg</code>Automating Configuration
Use --cloud-init with a YAML file to run commands on first boot:
<code>$ multipass launch --name ubuntu --cloud-init config.yaml</code>Example config.yaml :
<code>#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</code>The runcmd section runs these commands when the container first starts.
Conclusion
After using Multipass for a while, it proves useful for quick Linux experiments and small database clusters, though it only supports Ubuntu images because it is developed by Canonical.
Related Links
Official site: https://multipass.run/ Documentation: https://multipass.run/docs/
Java Captain
Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.
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.