Written by Indika on April 24, 2025

How to use Multipass to run virtual servers on your laptop for home labs

In this tutorial, we will use Multipass to run virtual servers for building home labs on our laptop.

In this tutorial, we will use Multipass to run virtual servers for building home labs on our laptop.

Multipass is a tool from Canonical for quickly running Ubuntu virtual servers on your laptop or on servers. It's one of the best tools for creating home labs.

You only a need a laptop (Linux, Mac, or Windows) with at least 4GB free memory to complete this tutorial.

Install Multipass

Multipass works on Linux, Mac, and Windows. You can install Multipass by following the installation instructions relevant for your platform.

Launch an Ubuntu virtual instance with Multipass

After installing Multipass, you can quickly launch an Ubuntu virtual instance.

$ multipass launch   

This will create a virtual instance with 1 CPU, 1GB memory, 5GB storage using the latest Ubuntu LTS release. Since The first time you run this command, it will take few minutes to launch the instance as Multipass has to download Ubuntu OS image. Subsequent launches will be considerably faster as Multipass will cache the downloaded image and reuse.

Check the status of the newly launched instance.

$ multipass list
Name                    State             IPv4             Image
sparkling-cowfish       Running           192.168.64.49    Ubuntu 24.04 LTS

Multipass has assigned a random name to our Ubuntu instance.

Launch an instance with specific CPU, memory, and disk capacity with Multipass

We don't want all our virtual instances to be just 1 CPU and 1GB memory. And we want meaningful names for the virtual servers in our home lab.

Let's launch an instance named my-lab with 2 CPU, 2GB memory and 20GB Hard disk.

$ multipass launch -c 2 -m 2GB -d 20GB --name my-lab

Logging into an instance created with Multipass

After creating a virtual server we can easily log into the terminal.

$ multipass shell my-lab

Using cloud-init with Multipass to configure an instance at launch

Password based SSH authentication is not enabled by default in virtual servers created with Multipass. Let's use cloud-init to enable this.

Create this file in the working directory and name it user-data.

#cloud-config
password: cloud123
chpasswd:
  expire: False
ssh_pwauth: True

This configuration enables password authenticated SSH login for the default user ubuntu.

Launch new virtual server.

$ multipass launch -c 2 -m 2GB -d 20GB --name my-server --cloud-init user-data

Get the virtual server's IP address.

$ multipass list
Name                    State             IPv4             Image
my-server               Running           192.168.64.52    Ubuntu 24.04 LTS

Log in to the virtual server with SSH.

$ ssh ubuntu@192.168.64.52

cloud-init has many other configuration parameters. Refer the documentation for more information.

Transfer files between an instance and the host

To copy files between the host and virtual servers, we can use multipass transfer.

Copy the file named test_file in working directory to the default home directory in virtual server my-vm.

$ multipass transfer ./test_file my-vm:test_file

Copy the hosts file in my-vm to the working directory on host.

$ multipass transfer my-vm:/etc/hosts ./hosts

Stop, delete and purge instances

Stop my-lab instance.

$ multipass stop my-lab

Delete my-lab.

$ multipass delete my-lab

Deleting a virtual server does not immediately remove it. So, if you deleted a virtual server accidentally you can recover it.

Recover the deleted my-lab virtual server.

$ multipass recover my-lab

To permanently remove deleted instances you can use the purge command.

$ multipass purge

This command will permanently remove all deleted virtual servers.

Wrapping up

In this tutorial, we used Multipass to create and manage virtual servers on our laptop.

Why do we need to run virtual servers like this?

For home labs.

As aspiring DevOps engineers, we need a lot of hands-on practice. And home labs are perfect for hands-on practice in Kubernetes, Linux, and DevOps tools, etc.

It does not cost us anything to launch virtual servers with Multipass. We don't need new hardware. We don't have to spend money on cloud service. We can start practicing right away on our laptop.

Happy home labs with Multipass !!!


Are you an aspiring DevOps engineer?

Subscribe now to The Cloud Letters to get actionable insights to accelerate your DevOps career.