multipass 简介
# multipass 安装
multipass version
# multipass使用
创建ubuntu虚拟机
$ multipass find
image aliases version description
snapcraft:core18 20201111 snapcraft builder for core 18
snapcraft:core20 20201111 snapcraft builder for core 20
core core16 20200818 ubuntu core 16
core18 20200812 ubuntu core 18
16.04 xenial 20210128 ubuntu 16.04 lts
18.04 bionic 20210129 ubuntu 18.04 lts
20.04 focal,lts 20210223 ubuntu 20.04 lts
20.10 groovy 20210209 ubuntu 20.10
appliance:adguard-home 20200812 ubuntu adguard home appliance
appliance:mosquitto 20200812 ubuntu mosquitto appliance
appliance:nextcloud 20200812 ubuntu nextcloud appliance
appliance:openhab 20200812 ubuntu openhab home appliance
appliance:plexmediaserver 20200812 ubuntu plex media server appliance
新建一个容器
multipass launch --name dg
launched: dg
exec dg -- lsb_release -d multipass
description: ubuntu 18.04.4 lts
# 操作虚拟机
name state ipv4 image
dg running 192.168.24.5 ubuntu 18.04 lts
现在有一台 ubuntu 18.04 版本的虚拟机在运行,对应的 ip 地址是:192.168.24.5 。
# 查看虚拟机信息
$ multipass info --all
name: dg
state: running
ipv4: 192.168.24.5
release: ubuntu 18.04.4 lts
image hash: fe3030933742 (ubuntu 18.04 lts)
load: 0.00 0.00 0.00
disk usage: 1.5g out of 4.7g
memory usage: 112.1m out of 985.7m
# 进入虚拟机
multipass shell dg
# 暂停/重启虚拟机
暂停
multipass stop dg
启动
multipass start dg
# 删除/释放虚拟机
删除
multipass delete dg
释放
multipass purge dg
# 配置自动化
$ multipass launch --name ubuntu --cloud-init config.yaml
config.yaml 是初始化配置文件,内容如下:
runcmd:
- curl -sl https://deb.nodesource.com/setup_12.x | sudo -e bash -
- sudo apt-get install -y nodejs
- wget https://releases.leanapp.cn/leancloud/lean-cli/releases/download/v0.21.0/lean-cli-x64.deb
- sudo dpkg -i lean-cli-x64.deb
原创文章,作者:校长,如若转载,请注明出处:https://www.yundongfang.com/yun273547.html