How to quickly launch Ubuntu virtual machine with Multipass

If you're a developer or a system administrator, you'll want to be able to quickly create virtual machines on a Linux distribution for testing. There are many different solutions, such as Docker, VMWare, VirtualBox, Vagrant, etc.

Multipass is a lightweight virtual machine manager that allows you to easily and quickly launch an Ubuntu virtual machine. Here is how you can do so.

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 any regular application. Just be aware that for Windows, you will need to install VirtualBox or Hyper-V. Hyper-V is only compatible with Windows 10 Pro and Windows 10 Enterprise. After installation, you can use Multipass from the Terminal.

For Linux, you can install Multipass using Snaps. After installing snapd, you can install Multipass with the command:

sudo snap install multipass --classic

Use Multipass

After installing Multipass, you can launch an instance (specific case) with:

multipass launch --name instance-name
Picture 1 of How to quickly launch Ubuntu virtual machine with Multipass Launch an instance with Multipass

By default, this command will download the current Ubuntu LTS (at the time of writing it is Ubuntu 20.04). You can set up multiple instances with Multipass (with different names) and then use them for different purposes. You can view installed instances with:

multipass list
Picture 2 of How to quickly launch Ubuntu virtual machine with Multipass View installed instances

You can also start and stop instances as you like with:

multipass start instance-name multipass stop instance-name

Multipass allows you to interact with and run commands within the virtual machine. To do this, you need to run the command:

multipass exec instance-name -- sudo apt update

The uses of Multipass

Multipass is useful from a development standpoint, because you can quickly test code on different versions of Ubuntu. However, it also has other great uses.

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 . Once completed, you can install the application whose GUI you want to see in a Multipass instance. You can then ask Multipass to open the application by pointing it at the computer's IP address.

Run Pi-Hole

Pi-Hole is a popular network-based ad blocker for Linux. You can set this ad blocker all over the network with the Raspberry Pi, but it's a bit more convenient to set this up with Multipass.

Set up a Kubernetes Cluster on Windows

Picture 3 of How to quickly launch Ubuntu virtual machine with Multipass Set up a Kubernetes Cluster on Windows

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

ncG1vNJzZmismaXArq3KnmWcp51ktbDDjK2mZqmlnrCsuNhmo5qtnpi1bsHBrqWtrV2rtrPA1JqjZqWRmLWqusRmrqKsmGK6trjToqeaq6M%3D