Multipass gives you Ubuntu VMs on demand for any workstation. It is a tool developed by canonical that allows you to launch Ubuntu virtual machines on your local machine.
In this guide we will explore how to use multipass, from installing to launching vms and deleting if not needed.
Install Multipass
You can use snap to install ubuntu. Use these commands:
sudo snap install multipass
sudo usermod -a -G microk8s ${USER}Launching a virtual machine
Upon installing multipass, you will get the multipass command in your terminal. Use this to launch the default ubuntu. By default, the LTS version of ubuntu will be launched – Ubuntu 20.04
multipass launch --name my-vmUsing cloud-init file
Pass a cloud-init metadata file to an instance on launch like this:
multipass launch -n bar --cloud-init cloud-config.yamlCustomize memory and disk size
You can use these arguments to specify the memory and disk size requirements:
multipass launch --name microk8s-vm --mem 4G --disk 40GExecute commands in the instance
Use the exec command to run commands inside the instance like in the following example:
multipass exec foo -- lsb_release -aLogging into the VM
If you want to SSH into the VM, use these commands:
multipass shell microk8sList instances
To see the list of instances launched by multipass, use this command:
multipass listStarting andn stopping the instances
Use this command to stop the instance
multipass stop foo barUse this command to start the instance:
multipass start fooDeleting instances
When no longer needed, you can clean up what you don’t need. The delete comand will not remove everything, so there is a purge command:
multipass delete bar
multipass purgeLaunching instances other than default
Find alternate images to launch with multipass:
multipass findGetting help
Use these commands to see the available options with multipass:
multipass help
multipass help <command>