官方說明:
Ubuntu VMs on demand for any workstation
Get an instant Ubuntu VM with a single command. Multipass can launch and run virtual machines and configure them with cloud-init like a public cloud. Prototype your cloud launches locally for free.
就是創建Ubuntu系統的虛擬機。
以前搭建Kafka、zookeeper集群的時候,總是會用visual box ,fusion(mac)等虛擬機技術。很巧地,前幾天看到了裝了個Ubuntu、Windows雙系統。看到了Ubuntu界面,感覺比以前使用Ubuntu的時候漂亮了挺多。於是打開了Ubuntu的官網。ubuntu.com/, 無意間看到了multipass工具。於是嘗試了下。覺得特別好用。對於那些不想花錢購買機器、又想有自己的多個linux系統的朋友,multipass很好用。而且關鍵的一點是用起來特別方便。
接下來我就把我使用multipass的操作記錄下來。分享給大家。
安裝multipass打開multipass.run/
multipass支持linux、windows、mac平臺使用。
本人再次使用mac版本
安裝有兩種方式:
brew install --cask multipass
執行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:
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
列出了所有的命令已經命令的含義。
創建虛擬機shell multipass launch -n vm1
launch可選擇參數可使用multipass launch -h查看。
這裡介紹幾個主要參數:
-n:指定虛擬機名稱
-c:指定cpu核數
-m:指定內存大小
-d:指定硬碟大小
執行結果:
multipass shell vm1
也可以使用exec指令。
刪除虛擬機後,重新使用一樣的名字創建vm,是不成功的。
這時候需要清理刪除的虛擬機後才能成功。
至此,multipass基本使用介紹完成。夢想越是美麗,就越是顯得遙不可及。可奇怪的是,一旦你下定了決心,很快地,那些夢想就一一成為了現實!