How to Quickly Launch Ubuntu Virtual Machine with Multipass

Multipass Tutorial Featured Image

If you are a developer or a system admin, you will want to be able to quickly spin up a Linux distro for testing. There are various solutions, like Docker, VMWare, VirtualBox, Vagrant, etc. Multipass is yet another lightweight VM manager that allows you to easily and quickly launch a Ubuntu virtual machine. Here is how you can do so.

Also read: How to Create a .Desktop File for Your Application in Linux

How to Set up Multipass

Multipass is available for Windows, macOS, and Linux. For Windows and macOS, you can download the relevant packages and install them like you would any normal application. Just note that for Windows, you will need to have either VirtualBox or Hyper-V installed. Hyper-V is only compatible with Windows 10 Pro and Windows 10 Enterprise. After installation, you will be able to use multipass from the terminal.

For Linux, you can install Multipass by using Snaps. You can install snapd on various distros with these instructions.

Once you have snapd installed, you can install multipass with the command:

sudo snap install multipass --classic

Using Multipass

After installing Multipass, you can launch an instance with:

multipass launch --name instance-name
Multipass Tutorial Launch

By default, this will download the current Ubuntu LTS, which as of this post, is Ubuntu 20.04. You can install multiple instances with Multipass (with different names) and then call them up for different purposes. You can view your installed instances with:

multipass list
Multipass Tutorial List 1

You can also start and stop instances at will with:

multipass start instance-name
multipass stop instance-name

Multipass allows you to interact and run commands inside the virtual machine. For this, you need the run the command:

multipass exec instance-name -- sudo apt update

Alternatively, if you prefer to “log in” to the instance, you can do so with the command:

multipass shell instance-name

Type exit to log out of the shell.

Multipass Use Cases

Multipass is useful from a development point of view since you can quickly test code on different versions of Ubuntu. However, there are other cool uses as well.

Run Linux GUI Applications on macOS

You can use XQuartz to display Linux GUI applications on macOS. To do this, you will have to set XQuartz to “Allow connections from network clients.” After this is done, you can install the application whose GUI you want to view in an instance of Multipass. You can then tell Multipass to open the app by pointing it to your computer’s IP address.

Run Pi-hole

Pi-hole is a network-wide ad blocker for Linux that is liked by many. You can set up a network wide-ad blocker with a Raspberry Pi, but it can be a little more convenient to set this up with Multipass since you won’t have to rely on having another piece of software. You can achieve this by setting up Pi-hole on a Multipass instance.

Set Up a Kubernetes Cluster on Windows

Multipass Tutorial Kubernetes

Kubernetes lets you manage workloads and services in a container. This allows for more efficient management of system resources. Kubernetes is an excellent option for running applications efficiently. You can use Multipass to set up Microk8s on a Multipass instance. This allows you to essentially be able to deploy a container with Kubernetes from a Windows machine.

Final Thoughts

Multipass is a useful tool for setting up an Ubuntu virtual machine quickly. You can use it to test code without having to mess with your current operating system. There are also a number of other tangible uses that don’t involve testing code which can make your life easier.

Alternatively, you can also make use of Virtual Machine Manager to manage your virtual machines in Linux.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

William Elcock

William has been fiddling with tech for as long as he remembers. This naturally transitioned into helping friends with their tech problems and then into tech blogging.