Charmed by multipass (lightning speed vm creation with multipass)

Olawepo Olayemi
3 min readJul 1, 2021

Very often I need to setup development enviroments ondemand for testing certain applications. Over the years this made me try several virtualization and ochestration tools for bringing up enviromnents. Some of the tools I have tried are vagrant, virtualbox, vmware, docker, podman, terraform, ancible e.t.c.

I actually can remember when virtualbox was first released and how it became one of the first few tools I install on any of my workstation, untill 2021, when I meet multipass and I have not stopped using it ever since ( so far its like falling inlove at 17).

Multipass is used to launch & manage VMs with a single Linux command, it is a very lightweight VM manager which is available on Linux, macOS as well as Windows. On Windows, it used Hyper-V, on Linux, it uses KVM & on Mac it used HyperKit.

Multipass is a product from canonical and you can find their pages & installation guide here.

To install multipass on linux, it easy as using snap.
sudo snap install multipass if you do not like working on terminal you may not really like this but guess what it works with virtualbox GUI too ( Mac & Windows)!

Download windows and Mac installer and install. Thats it now you are set to chunk out virtual machines as you need.

LAUCH VMs WITH MULTIPASS

multipass launch -m 2Gb -n <name> <image name>

multipass launch -m 2Gb -d 50G -c 4 -n pmaster 18.04

It is also possible to use cloud-init for custom installs, we will not be doing that now but maybe in my next post on using multipass with some other tools.

Execute commands directly on an instance with multipass exec [options] <name> [--] <command> , so for example get the operating system name;

multipass exec pmaster -- uname -r

or execute scripts from a mounted directory see example below;

multipass mount ${A_DIRECTORY} instance_name
multipass exec -v instance_name -- ${A_DIRECTORY}/your_script.sh

SSH TO YOUR VM

multipass shell <name>

multipass shell pmaster

if all goes well you should be in your new spec’ed vm and can have fun with your new enviroment!

DELETE A VM

multipass delete <instance name>

multipass delete pmaster
multipass purge
multipass list

Being able to manage your vms fluently from terminal opens more room to script the provisioning in a very fast, simple and efficient way. To get your hands dirty with this naughty boy, see the multipass doc in the mean time, happy multipassing!!

--

--

Olawepo Olayemi

SW Generalist, Test Automation engineer, Technology enthusiast and entrepreneur. I Love Python and brewing my own beer (IPA usually).