当前位置:网站首页>Multipass中文文档-设置驱动
Multipass中文文档-设置驱动
2022-06-26 04:35:00 【但老师】
总目录(待翻译完完善)
1. 概览
2. 教程
3. 使用指引
3.1 安装Multipass
3.1.1 基于Linux
3.1.2 基于macOS
3.1.3 基于Windows
3.2 管理实例
3.2.1 创建实例
3.2.2 修改实例
3.2.3 使用实例
3.2.4 使用实例命令别名
3.2.5 与实例共享数据
3.2.6 移除实例
3.3 管理Multipass
3.3.1 设置驱动
3.3.2 使用Multipass服务授权代理
3.3.3 远程使用Multipass
3.3.4 提高挂载性能
3.3.5 使用Packer打包Multipass镜像
3.3.6 设置图像界面
3.3.7 使用不同的macOS终端
3.4 问题排查
3.4.1 连接日志
3.4.2 网络问题排查
如何设置驱动
也见: Driver
这篇文档教授了如何选取, 设置并管理Multipass后台的驱动. Multipass已经有比较灵活的默认设置了, 所以这只是一个可选步骤.
内容:
Linux: 使用libvirt
Multipass在Linux上默认使用qemu驱动. 如果在VM启动后, 你想要更多的控制权, 你也可以使用试验阶段的libvirt驱动. 该部分会教你如何使用.
安装libvirt
执行下面命令安装libvirt:
# 需要根据你的发行版使用同等命令
$ sudo apt install libvirt-daemon-system
切换Multipass驱动到libvirt
也见: stop, local.driver
首先, 允许Multipass使用本地libvirt:
# 连接到libvirt接口/插件
$ snap connect multipass:libvirt
然后, 切换Multipass驱动到libvirt,运行:
# 首先你得停止所有实例
$ multipass stop --all
# 然后让Multipass使用libvirt
$ sudo multipass set local.driver=libvirt
你所有的实例都会被迁移并且可以直接使用.
️ 你仍然可以使用
multipass代理和托盘图表(tray icon), 并且任何你在libvirt所作的配置修改都是永久性的. 尽管他们并不会在Multipass命令(例如multipas info)中显示
使用libvirt查看Multipass实例
你可以通过2种方式用libvirt查看实例, 使用virshCLI或者是virt-manager GUI
使用virshCLI, 需要启动实例, 然后执行virsh list(命令参考见man virsh):
$ virsh list
ID Name State
-------------------------------
1 unaffected-gyrfalcon running
另一可选方案, 使用virt manager GUI,…
切回默认驱动
也见: stop, local.driver
执行下面命令切回默认的qemu驱动:
# 再次停止所有实例
$ multipass stop --all
# 切回qemu驱动
$ sudo multipass set local.driver=qemu
这里也是, 现存实例都会被迁移.
️ 这会让你丢失你在libvirt上所作的任何定制改动.
macOS: 使用VirtualBox
Multipass在Intel macOS上默认使用hyperkit驱动, M1 macOS默认使用qemu驱动. 然而, 一个可选项是使用VirtualBox.
切换Multipass驱动到VirtualBox (macOS)
也见: stop, local.driver
执行下面命令切换Multipass驱动到VirtualBox:
$ sudo multipass set local.driver=virtualbox
此后, 所有使用multipass launch启动的实例都会在后台使用VirtualBox.
使用VirtualBox查看Multipass实例
Multipass会以root身份运行, 所以如果需要查看VirtualBox中的实例, 或者通过VBoxManage命令, 你也需要让他们以root身份运行. 运行下面命令查看VirtualBox中的实例:
$ sudo VirtualBox

并且, 需要在命令行列出实例的话, 执行:
$ sudo VBoxManage list vms
"primary" {
395d5300-557d-4640-a43a-48100b10e098}
️ 你仍然可以使用
multipass代理和系统菜单图表(system menu icon), 并且任何你在VirtualBox所作的配置修改都是永久性的. 尽管他们并不会在Multipass命令(例如multipas info)中显示
使用VirtualBox设置Multipass实例端口转发
为了让你主机上实例中运行的服务暴露出来, 你可以使用VirtualBox的端口转发规则, 例如:
$ sudo VBoxManage controlvm "primary" natpf1 "myservice,tcp,,8080,,8081"
然后你可以打开,例如, [http://localhost:8081]/(http://localhost:8081), 在实例中端口8080运行的服务就会暴露出来.
使用VirtualBox设置Multipass实例网络桥接
一个经常被关注的Multipass点就是网络桥接. 你可以给实例添加第二个网络接口, 并将其暴露在你的物理网络中.
首先, 停止实例:
$ multipass stop primary
现在找到你想要桥接的网络接口(在第二个冒号后面找你想要的字符标识):
$ VBoxManage list bridgedifs | grep ^Name
Name: en0: Ethernet
Name: en1: Wi-Fi (AirPort)
Name: en2: Thunderbolt 1
Name: en3: Thunderbolt 2
...
最后, 让VirtualBox将第二个接口作为"父级"使用(更多关于桥接的信息参见 VirtualBox主题文档:
# 别碰 --nic1, 因为Multipass正在使用它
$ sudo VBoxManage modifyvm primary --nic2 bridged --bridgeadapter2 en0
你可以再次重启实例, 找到新接口的名称:
$ multipass start primary
$ multipass exec primary ip link | grep DOWN
3: enp0s8: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
并配置新接口 – Ubuntu使用netplan处理:
$ multipass exec -- primary sudo bash -c "cat > /etc/netplan/60-bridge-yaml" <<EOF network: ehernets: enp0s8: # 这就是上面的接口名称 dhcp4: true dhcp4-overrides: # 这是必须的 route-metric: 200 # 默认网关给第一个接口保留 version: 2 EOF
$ multipass exec primary sudo netplan apply
最后, 找到鹿由给你的实例IP:
$ multipas exec primary ip address show dev enp0s8 up
3: enp0s8: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:2a:5f:55 brd ff:ff:ff:ff:ff:ff
inet 10.2.0.39/24 brd 10.2.0.255 scope global dynamic enp0s8
valid_lft 86119sec preferred_lft 86119sec
inet6 fe80::a00:27ff:fe2a:5f55/64 scope link
valid_lft forever preferred_lft forever
所有实例中的任务现在应该都可以通过物理网络路径 http://<ip>/使用
切回默认驱动
也见: stop, local.driver
如果你想切回默认驱动,运行:
$ sudo multipass set local.driver=hyperkit
使用VirtualBox创建的实例无法转移, 但是你随时可以回来找到他们.
Windows: use VirtualBox
Multipass在Windows上默认使用hyperv驱动. 然而, 如果你想(或必须), 你可以将Multipass使用的虚拟机监视器(hypervisor)换为VirtualBox.
Install VirtualBox
如果你还没安装, 就先安装VirtualBox. 你会发现你需要以管理员身份运行VirtualBox安装包.
切换Multipass驱动到VirtualBox
也见: stop, local.driver
你可以让Multipass使用它(也需要管理员权限):
PS> multipass set local.driver=virtualbox
此后, 所有multipass launch启动的实例在后台都会使用VirtualBox.
使用VirtualBox查看Multipass实例
Multipass会以系统身份运行, 所以如果需要查看VirtualBox中的实例, 或者通过VBoxManage命令, 你必须通过PsExec -s运行. 下载并解压下载文件夹的PSTools.zip, 然后在管理员权限的PowerShell, 运行:
PS> & $env:USERPROFILE\Downloads\PSTools\PsExec.exe -s -i $env:VBOX_MSI_INSTALL_PATH\VirtualBox.exe

在命令行列出实例:
PS> & $env:USERPROFILE\Downloads\PSTools\PsExec.exe -s $env:VBOX_MSI_INSTALL_PATH\VBoxManage.exe list vms
"primary" {
05a04fa0-8caf-4c35-9d21-ceddfe031e6f}
️ 你仍然可以使用
multipass代理和系统菜单图表(system menu icon), 并且任何你在VirtualBox所作的配置修改都是永久性的. 尽管他们并不会在Multipass命令(例如multipas info)中显示
使用VirtualBox设置Multipass实例端口转发
为了让你主机上实例中运行的服务暴露出来, 你可以使用VirtualBox的端口转发规则, 例如:
PS> & $env:USERPROFILE\Downloads\PSTools\PsExec.exe -s $env:VBOX_MSI_INSTALL_PATH\VBoxManage.exe controlvm "primary" natpf1 "myservice,tcp,,8080,,8081"
然后你可以打开,例如, [http://localhost:8081]/(http://localhost:8081), 在实例中端口8080运行的服务就会暴露出来.
切回默认驱动
也见: stop, local.driver
也见: stop, local.driver
如果你想切回默认驱动:
PS> multipass set local.driver=hyperkit
使用VirtualBox创建的实例无法转移, 但是你随时可以回来找到他们.
原文链接
边栏推荐
- A troubleshooting of website crash due to high CPU
- Thinkphp6 using kindeditor
- Jenkins introduces custom jars
- 1.24 learning summary
- Guide de la pompe de données Oracle
- [H5 development] 03- take you hand in hand to improve H5 development - single submission vs batch submission with a common interface
- Rdkit chemical formula molecular formula search
- Analysis report on development trend and market demand of global and Chinese molecular diagnostics industry from 2022 to 2028
- Development trend and prospect forecast report of China's financial industry 2022-2028 Edition
- Zhubo Huangyu: all the precious metals you want to know are here
猜你喜欢

mysql高级学习(跟着尚硅谷老师周阳学习)

Modify the number of Oracle connections

How to carry out word-of-mouth marketing for enterprises' products and services? Can word of mouth marketing be done on behalf of others?
![[H5 development] 02 take you to develop H5 list page ~ including query, reset and submission functions](/img/39/64df931d5ec54d7d19ae444fa372ba.jpg)
[H5 development] 02 take you to develop H5 list page ~ including query, reset and submission functions
![There is no response to redirection and jump in the laravel constructor [original]](/img/6b/5d9d7fe1348892d01a87d04f122dfc.jpg)
There is no response to redirection and jump in the laravel constructor [original]

Minecraft 1.16.5 biochemical 8 module 1.9 version 1.18 version synchronization

NPM installation tutorial

Install dbeaver and connect Clickhouse
![[Qunhui] import certificate](/img/1f/ab63b0556a60b98388b482d70f6156.jpg)
[Qunhui] import certificate
![Tp6 is easy to tread [original]](/img/e9/4b2fbd485387c5ed9e75bd0451a19c.jpg)
Tp6 is easy to tread [original]
随机推荐
0622-马棕榈跌9%
微软禁止俄用户下载安装Win10/11
Ubuntu installs PostgreSQL and uses omnidb to view
Oracle 数据泵导表
digital image processing
I like you!
6、 Project practice --- identifying cats and dogs
Add, delete, modify and query curd in PHP native SQL
Redis cache message queue
1.19 learning summary
Nightmare
Thinkphp6 using kindeditor
Laravel pay payment access process
NPM installation tutorial
Group by and order by are used together
#微信小程序# 在小程序里面退出退出小程序(navigator以及API--wx.exitMiniProgram)
mysql高级学习(跟着尚硅谷老师周阳学习)
numpy 随机数
Thinkphp6 implements a simple lottery system
How to use the configured slave data source for the scheduled task configuration class scheduleconfig