Creating Virtual Machines with Multipass
Multipass is a tool built by Canonical who are the creators and maintainers of Ubuntu and Multipass is great for spinning up Virtual Machines (VMs). We use it at Vizalo daily for testing and have been using it for around nine months now and it's been flawless. But enough of this intro, let's actually create a VM!
This tutorial is going to assume you have installed Multipass, if you haven't then follow the instructions here
Our first VM
Now you've got Multipass installed let's create our first VM. As a side note since v1.14 Multipass has shipped with a GUI to manage VMs but we're going to use the command line for this tutorial.
Creating our first VM is as simple as running:
multipass launch
this will launch us a VM using the latest LTS version of Ubuntu which at the time of writing is 24.04 and give it a random name. The first launch will take a while as Multipass needs to download the LTS image, setup a bridge and assign an IP address.
Once that is done we can find the name of our VM using:
multipass list
that will list all of the instances we have on the machine. We can then grab the machines name and connect to it by running:
multipass shell <name>
Now we're in our VM and we can do what we want! We can run a Node.js app and deal with huge node_modules directories or we could even switch to the root user with sudo su
Choosing our own name
Right now we have to use the multipass list
to get the name of our VM. Instead we can give our VM a name we can remember when we launch it using the --name
flag like so:
multipass launch --name <name>
Now when we use the multipass shell
command we can use the name we specified at launch!
Wrapping up
We've covered the basics of Multipass and figured out how to get a VM up and running. In a future tutorial we will cover configuring a VM at launch with a cloud-init file.