Spin up command-line Ubuntu VMs in (almost) seconds
Tags: infra
Published: 2024-03-23 11:09:52

---
title: Spin up command-line Ubuntu VMs in (almost) seconds
published: true
date: 2024-03-23 11:09:13 UTC
tags: Infra
canonical_url: https://www.paleblueapps.com/rockandnull/spin-up-ubuntu-vms-multipass/
---

 ![Spin up command-line Ubuntu VMs in (almost) seconds](https://images.unsplash.com/photo-1629654297299-c8506221ca97?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8c2VhcmNofDF8fGxpbnV4fGVufDB8fHx8MTcxMTE5MTk0MHww&ixlib=rb-4.0.3&q=80&w=2000)

Sometimes, you need a clean and disposable Linux environment to test configuration changes, try out a new tool, or simply isolate your experiments from your main system. There's a lightning-fast and easy way to launch Ubuntu command-line virtual machines (VMs) on Windows, macOS, or even Linux.

This is a super quick primer on how you can get started quickly. In less than 10 minutes you can have your command line Ubuntu VM.

## **What is Multipass?**

Developed by Canonical (the company behind Ubuntu), Multipass provides a streamlined way to manage Ubuntu VMs. With a single command, you can spin up a fresh Ubuntu instance, perfect for those quick testing scenarios.

Multipass VMs have a relatively small footprint, conserving your system resources.

## **Quick start**

Firstly, head to the [Multipass website](https://multipass.run/?ref=paleblueapps.com) and follow the installation instructions for your operating system.

### **Launch your first VM**

```
multipass launch 

```

That's it. This command downloads the Ubuntu image and boots up a VM. As soon the latest Ubuntu LTS (long-term support) image is downloaded and deployed, you will be entered into the shell.

Every time you run this command a new VM is created.

### Launch an existing VM

```
mutlipass shell <vm-name>
```

For follow-up runs, use this command to launch into the shell of an existing VM. If you only have 1 VM, you can omit `vm-name`.

### **Mount a host directory**

```
multipass mount <source-path-on-host> <vm-name>:<mount-point-in-vm>

```

The default name for the `vm-name` is `primary`.

### Start/Stop/Delete/List VMs

```
multipass delete <vm-name> 


multipass start <vm-name>


multipass stop <vm-name>


multipass list

```

Quite self-explanatory commands. With these, you can manage the VMs in your system.

### Modify VM resources

Almost certainly, you will need to modify the resources of your VMs at some point. Fear not, you can do it quickly ([documentation](https://multipass.run/docs/modify-an-instance?ref=paleblueapps.com)):

```
multipass set local.<vm-name>.cpus=4

multipass set local.<vm-name>.disk=60G

multipass set local.<vm-name>.memory=7G
```

## **Alternatives for VMs with GUI**

If you require a full-fledged Linux VM with a graphical desktop environment:

- **UTM (macOS):** A streamlined VM solution tailored for macOS. Highly recommended, really polished, and easy to use.
- **VirtualBox (Windows, macOS, Linux):** A powerful and versatile virtualization platform with more extensive configuration options.

Give Multipass a try the next time you need a quick and isolated Linux environment. Its simplicity and speed will make it an indispensable tool in your development workflow.

Happy hacking!