qndell15@qndell15:~$ time multipass launch file:///home/qndell15/hirsute-server-cloudimg-amd64.img
Launched: equipped-marsupial
real 0m39.112s
user 0m0.040s
sys 0m0.064s
qndell15@qndell15:~$ multipass shell ornamental-yeti
Welcome to Ubuntu 21.04 (GNU/Linux 5.11.0-22-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Mon Jul 12 06:32:02 UTC 2021
System load: 0.08 Processes: 122
Usage of /: 27.8% of 4.67GB Users logged in: 0
Memory usage: 2% IPv4 address for ens4: 10.24.205.12
Swap usage: 0%
0 updates can be applied immediately.
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
ubuntu@ornamental-yeti:~$
挂载本地目录到某个vm
qndell15@qndell15:~$ multipass mount ./xx ornamental-yeti:/home/ubuntu/xx
qndell15@qndell15:~$ multipass info ornamental-yeti
Name: ornamental-yeti
State: Running
IPv4: 10.24.205.12
Release: Ubuntu 21.04
Image hash: 4a6326003505 (Ubuntu 21.04)
Load: 0.10 0.09 0.05
Disk usage: 1.3G out of 4.7G
Memory usage: 160.5M out of 7.8G
Mounts: /home/qndell15/xx => /home/ubuntu/xx
UID map: 1000:default
GID map: 1000:default
从vm拷贝文件到本地
qndell15@qndell15:~$ multipass transfer ornamental-yeti:/home/ubuntu/ttx .
qndell15@qndell15:~$ ls ttx
ttx
list 本地vm 列表
qndell15@qndell15:~$ multipass list
Name State IPv4 Image
discerning-skylark Running 10.24.205.162 Ubuntu 21.04
10.24.205.211
equipped-marsupial Running 10.24.205.57 Ubuntu 21.04
honorary-snailfish Running 10.24.205.41 Ubuntu 21.04
10.24.205.212
perky-accentor Running 10.24.205.84 Ubuntu 21.04
10.24.205.99
Available commands:
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
version Show version details
在本地构建vm有四种方式
3是最近发现的一种构建方式,也是一种很快的构件方式. 启动一个vm只需要39s
这样本地启动一个集群就特别方便了
查询可以使用image
创建一个vm
其中可以通过 -c 指定核数, -m 指定内存大小, -d 指定磁盘大小
ssh到某个vm里
挂载本地目录到某个vm
从vm拷贝文件到本地
list 本地vm 列表
远程执行命令
以上参数基本满足了日常操作, 详细命令可以参考 multipass 官网: