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
© 版权声明
文章版权归作者所有,未经允许请勿转载。