Multipass is a tool to generate cloud-style Ubuntu virtual machines quickly on Linux, macOS, and Windows. Specifically, it’s a lightweight virtual machine (VM) manager, designed for developers who want a fresh Ubuntu environment with a single command. It uses KVM on Linux, Hyper-V on Windows and HyperKit on macOS to run a VM with minimal overhead. Because it supports metadata for cloud-init, you can also simulate a small cloud deployment on your laptop or workstation. In short, Multipass makes running Ubuntu virtual machines fast and easy.
Install Multipass:
1 2 |
$ sudo snap install multipass multipass 1.11.0 from Canonical✓ installed |
Should you ever decide to uninstall Multipass:
1 |
$ sudo snap remove multipass |
Validate your Multipass installation by checking the version:
1 |
$ multipass version |
As long as you see a version returned in your terminal, Multipass has been installed!
Using Multipass
Before getting started, take a look at the online help available with Multipass:
1 |
$ multipass help |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Usage: multipass [options] <command> Create, control and connect to Ubuntu instances. Available commands: alias Create an alias aliases List available aliases authenticate Authenticate client delete Delete instances exec Run a command on an instance find Display available images to create instances from get Get a configuration setting help Display help about a command info Display information about instances launch Create and start an Ubuntu instance ... |
Launch the lts
image which, along with jammy
, is aliased to the 22.04
image. You can use any of those names to launch the image. Use the multipass launch
command:
1 |
$ multipass launch lts |
Once the instance is up, you get a Launched
message, along with a random instance name (it’s unanimous-harrier
in my case, but it’ll be unique for you).
You can see a list of instances using the multipass list
command:
1 |
$ multipass list |
If you want to get detailed information about an instance, use the multipass info
command:
1 |
$ multipass info unanimous-harrier |
Interact with a Multipass instance
Now that you have an instance up and running, it’s time to put it to good use! One way to interact with your instance is to open a shell using the multipass shell
command:
1 |
$ multipass shell unanimous-harrier |
Take a look at the contents of /etc/os-release
to get some information on your instance. As you can see, you can interact with your instance using a shell, just like any other Linux machine.
You might want to execute a command without opening a shell, though. You can do that with the multipass exec
command:
1 |
$ multipass exec unanimous-harrier -- cat /etc/os-release |
You see the same information as when you executed the command in a shell, without the interactive shells session.
Cleanup
The beauty of having your own little private cloud is that you can easily get rid of resources that you’re finished with. Take a look at your instances:
1 |
$ multipass list |
I still have my unanimous-harrier
instance, but assume I’m finished with it. First, stop the instance:
1 |
$ multipass stop unanimous-harrier |
Confirm that it’s stopped:
1 |
$ multipass list |
Now delete the instance:
1 |
$ multipass delete unanimous-harrier |
Verify your work:
1 |
$ multipass list |
If you want to completely remove an instance, use the multipass purge
command:
1 |
$ multipass purge |
Verify your work:
1 |
$ multipass list |
You see no instances in the output!
Virtual clouds
By using Multipass, you can leverage the power of Ubuntu Linux and cloud-init
to manage your own little private cloud, in the comfort of our Ubuntu Linux environment.
If you’d like to dig a little deeper into running instances using Multipass, here are some good resources:
1 Comment
Konstantin Mladenov · 2023-08-08 at 14:36
Great article! I’ve needed something like this for a very long time but I’ve been too lazy to do research, this checks all the boxes!