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.
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
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
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
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.
Our latest tutorials delivered straight to your inbox