1. What is Multipass?
Official website: https://multipass.run/
When it comes to virtual machines, people generally think of VMvare and Virtual Box, two virtual machine software. One of the more troublesome parts of these two software is that after installing the virtual machine, you need to download the operating system image. The editor discovered Multipass by accident. This lightweight virtual machine manager can quickly install an Ubuntu environment with just one command.
Multipass is a lightweight virtual machine manager that is an open source project launched by Canonical, the company that runs Ubuntu officially. The runtime environment supports Linux and provides a command line interface to start and manage Linux instances. It takes seconds to download a fresh image and have a VM up and running in minutes.
Features
-
Ease of use: Multipass provides a simple and intuitive command line interface that allows you to easily create, start, stop and delete virtual machine instances.
-
Rapid Deployment: By using pre-configured base images, Multipass can quickly spin up virtual machines in seconds.
-
Lightweight: Multipass VMs are very lightweight and take up less system resources, which allows you to run multiple VM instances simultaneously without slowing down your computer.
-
Integration with cloud platforms: Multipass supports integration with cloud platforms (such as AWS, Azure, and GCP), allowing you to deploy virtual machine instances to the cloud.
-
Highly customizable: Multipass allows you to choose different operating systems and configuration options for virtual machine instances to meet specific needs.
Multipass supports cross-platform, so it can be installed on Linux, Windows and macOS. This article uses the Win10 operating system to introduce Multipass installation and other related knowledge.
Essentially, Multipass is used to manage virtual machine engines on various platforms , such as:
Hyper-V 和 VirtualBox(Windows)
KVM(Linux)
HyperKit(macOS)
Therefore, you need to install the corresponding virtual machine engine before using it, and then manage it through Multipass.
Second, install the virtual machine Virtual Box
Download the free Virtual Box from the official website and install it.
https://pan.quark.cn/s/4e34a2f09f56
3. Install Multipass
download link:
https://pan.quark.cn/s/4fe07ab88e7e
The installation package is very small, only more than 20 M.
Double-click to install, and then the next step.
I have installed Virtual Box, so I chose [Oracle VM Virtual Box]
Add environment variables.
Select the installation path.
Install
After the installation is complete, it can be used.
4. Use Multipass
4.1 Help for using Multipass
Enter multipass on the command line to get help on using Multipass.
C:\Users\Administrator>multipass
Usage: multipass [options] <command>
Create, control and connect to Ubuntu instances.
This is a command line utility for multipass, a
service that manages Ubuntu instances.
Options:
-?, -h, --help Displays help on commandline options.
--help-all Displays help including Qt specific options.
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short
option for more detail. Maximum verbosity is obtained with 4
(or more) v's, i.e. -vvvv.
Available commands:
alias Create an alias
aliases List available aliases
authenticate Authenticate client
delete Delete instances
exec Run a command on an instance
find Display available images to create instances from
get Get a configuration setting
help Display help about a command
info Display information about instances
launch Create and start an Ubuntu instance
list List all available instances
mount Mount a local directory in the instance
networks List available network interfaces
purge Purge all deleted instances permanently
recover Recover deleted instances
restart Restart instances
set Set a configuration setting
shell Open a shell on a running instance
start Start instances
stop Stop running instances
suspend Suspend running instances
transfer Transfer files between the host and instances
umount Unmount a directory from an instance
unalias Remove an alias
version Show version details
View the installed Multipass version information
C:\Users\Administrator>multipass version
multipass 1.9.1+win
multipassd 1.9.1+win
4.2 Create an instance
The multipass launch command is used to create an instance.
You can create an instance with the following command.
multipass launch --name <实例名称>
multipass launch -n <实例名称>
If the name parameter is not specified, multipass will randomly generate an instance name.
View the created instance.
C:\Users\Administrator>multipass list
No instances found. --》当前没有创建任何实例
example:
--下载镜像
C:\Users\Administrator>multipass launch
Retrieving image: 5%
--创建实例acceptable-joey
C:\Users\Administrator>multipass launch
Starting acceptable-joey -
** When launch creates an instance for the first time, it will take a few minutes to download the image, and then launch will directly create the instance.
4.3 View the instance list
C:\Users\Administrator>multipass list
Name State IPv4 Image
acceptable-joey Running N/A Ubuntu 20.04 LTS
View instance information with the following command
multipass info <实例名称>
example:
C:\Users\Administrator>multipass info acceptable-joey
Name: acceptable-joey
State: Running
IPv4: N/A
Release: Ubuntu 20.04.4 LTS
Image hash: 75a04c7eed58 (Ubuntu 20.04 LTS)
Load: 0.24 0.17 0.07
Disk usage: 1.4G out of 4.7G
Memory usage: 137.7M out of 976.9M
Mounts: --
Create named instances:
C:\Users\Administrator>multipass launch -n test
Launched: test
C:\Users\Administrator>multipass launch --name test2
Launched: test2
C:\Users\Administrator>multipass list
Name State IPv4 Image
acceptable-joey Running N/A Ubuntu 20.04 LTS
test Running N/A Ubuntu 20.04 LTS
test2 Running N/A Ubuntu 20.04 LTS
delete instance
multipass delete test2 --purge
C:\Users\Administrator>multipass list
Name State IPv4 Image
acceptable-joey Running N/A Ubuntu 20.04 LTS
test Running N/A Ubuntu 20.04 LTS
4.4 Shutting down and starting an instance
C:\Users\Administrator>multipass stop acceptable-joey
C:\Users\Administrator>multipass stop test
C:\Users\Administrator>multipass list
Name State IPv4 Image
acceptable-joey Stopped -- Ubuntu 20.04 LTS
test Stopped -- Ubuntu 20.04 LTS
C:\Users\Administrator>multipass start test
C:\Users\Administrator>multipass list
Name State IPv4 Image
acceptable-joey Stopped -- Ubuntu 20.04 LTS
test Running N/A Ubuntu 20.04 LTS
4.5 Use cases
Start using the instance's command line through the multipass shell.
multipass shell <实例名称>
example:
C:\Users\Administrator>multipass shell test
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-120-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Wed Jun 22 21:29:00 CST 2022
System load: 0.0 Processes: 102
Usage of /: 29.1% of 4.67GB Users logged in: 0
Memory usage: 19% IPv4 address for enp0s3: 10.0.2.15
Swap usage: 0%
1 update can be applied immediately.
To see these additional updates run: apt list --upgradable
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
ubuntu@test:~$ pwd
/home/ubuntu
ubuntu@test:~$ hostname
test
ubuntu@test:~$ id
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),117(netdev),118(lxd)
This is an ubuntu virtual machine, you can use it to your heart's content. Isn't it very convenient!