canonical/multipass

GitHub: canonical/multipass

跨平台轻量级 Ubuntu 虚拟机管理器,通过单条命令快速启动和管理本地 Ubuntu 实例。

Stars: 9149 | Forks: 800

# 什么是 Multipass? Multipass 是一个适用于 Linux、Windows 和 macOS 的轻量级虚拟机管理器。专为希望使用单条命令快速启动全新 Ubuntu 环境的开发者而设计。它在 Linux 上使用 KVM,在 Windows 上使用 Hyper-V,并在 macOS 上使用 QEMU 来运行虚拟机,开销极小。它也可以在 Windows 和 macOS 上使用 VirtualBox。Multipass 会为你获取 Ubuntu 镜像并保持其更新。 由于它支持 cloud-init 的元数据,你可以在笔记本电脑或工作站上模拟小型云部署。 ## 项目状态 | 服务 | 状态 | |------------------------------------------------------|:------------------------------------------------| | [CI](https://github.com/canonical/multipass/actions) | [![Build Status](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/18626d6a5f003055.svg)][gha-url] | | [Snap](https://snapcraft.io/) | [![Build Status](https://snapcraft.io/multipass/badge.svg)][snap-url] | | [Codecov](https://codecov.io/) | [![Codecov Status](https://codecov.io/gh/canonical/multipass/branch/main/graph/badge.svg)][codecov-url] | # 安装 * 在 **Linux** 上,Multipass 可以作为 snap 安装: sudo snap install multipass * 在 **macOS** 上,[从 GitHub](https://github.com/canonical/multipass/releases) 下载安装程序。 此外,你也可以使用 [Homebrew](https://github.com/Homebrew/brew)。请注意,此方法**不受官方支持**,因为它不是由 Multipass 团队维护的,而是由社区维护的。Multipass 可以作为 cask 获取: brew install --cask multipass 请注意,在安装过程中,某些 sudo 操作可能需要你输入密码。在 macOS 上,为了成功启动 multipass 实例,你可能还需要禁用防火墙。 * 在 **Windows** 上,[从 GitHub](https://github.com/canonical/multipass/releases) 下载安装程序。 有关更多信息,请参阅[如何安装 Multipass](https://canonical.com/multipass/docs/install-multipass)。 # 用法 以下是一些帮助你入门 Multipass 的提示。如需更全面的学习体验,请查看 Multipass [教程](https://canonical.com/multipass/docs/tutorial)。 ## 查找可用镜像 ``` $ multipass find Image Aliases Version Description 20.04 focal 20240731 Ubuntu 20.04 LTS 22.04 jammy 20240808 Ubuntu 22.04 LTS 24.04 noble,lts 20240806 Ubuntu 24.04 LTS Blueprint Aliases Version Description anbox-cloud-appliance latest Anbox Cloud Appliance charm-dev latest A development and testing environment for charmers docker 0.4 A Docker environment with Portainer and related tools jellyfin latest Jellyfin is a Free Software Media System that puts you in control of managing and streaming your media. minikube latest minikube is local Kubernetes ros-noetic 0.1 A development and testing environment for ROS Noetic. ros2-humble 0.1 A development and testing environment for ROS 2 Humble. ``` ## 启动当前 Ubuntu LTS 的全新实例 ``` $ multipass launch lts Launched: dancing-chipmunk ``` ## 查看正在运行的实例 ``` $ multipass list Name State IPv4 Image dancing-chipmunk Running 192.168.64.8 Ubuntu 24.04 LTS phlegmatic-bluebird Stopped -- Ubuntu 22.04 LTS docker Running 192.168.64.11 Ubuntu 22.04 LTS 172.17.0.1 ``` ## 了解有关实例的更多信息 ``` $ multipass info dancing-chipmunk Name: dancing-chipmunk State: Running Snapshots: 0 IPv4: 192.168.64.8 Release: Ubuntu 24.04 LTS Image hash: e2608bfdbc44 (Ubuntu 24.04 LTS) CPU(s): 1 Load: 5.70 4.58 2.63 Disk usage: 3.3GiB out of 4.8GiB Memory usage: 769.0MiB out of 953.0MiB Mounts: -- ``` ## 连接到正在运行的实例 ``` $ multipass shell dancing-chipmunk Welcome to Ubuntu 24.04 LTS (GNU/Linux 6.8.0-39-generic aarch64) ... ``` 别忘了注销(或 Ctrl-D),否则你可能会发现自己一路陷入《盗梦空间》般的深层梦境... ;) ## 在外部实例内运行命令 ``` $ multipass exec dancing-chipmunk -- lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04 LTS Release: 24.04 Codename: noble ``` ## 停止实例以节省资源 ``` $ multipass stop dancing-chipmunk ``` ## 删除实例 ``` $ multipass delete dancing-chipmunk ``` 该实例现在将显示为已删除: ``` $ multipass list Name State IPv4 Image dancing-chipmunk Deleted -- Ubuntu 24.04 LTS phlegmatic-bluebird Stopped -- Ubuntu 22.04 LTS docker Running 192.168.64.11 Ubuntu 22.04 LTS 172.17.0.1 ``` 如果你想将其彻底清除: ``` $ multipass purge ``` ## 获取帮助 ``` multipass help multipass help ``` ## 构建 Multipass 请按照以下文件中针对特定平台的构建说明进行操作: * [BUILD.linux.md](./BUILD.linux.md) 用于 Linux * [BUILD.macOS.md](./BUILD.macOS.md) 用于 macOS * [BUILD.windows.md](./BUILD.windows.md) 用于 Windows ### 通用构建提示 **Qt 版本兼容性** Multipass 已通过 **Qt 6.9.1** 的测试。6.9 系列中较新的补丁版本(例如 6.9.2)应该没有问题。较新的次要版本可能可以运行,但可能会导致兼容性问题。 你可以使用首选的包管理器来安装 Multipass。 请注意,仅官方安装程序受支持。 有关详细信息,请参阅[安装指南](https://documentation.ubuntu.com/multipass/en/latest/how-to-guides/install-multipass/)。 有关后端支持和系统要求,请参阅 [Multipass 驱动程序文档](https://documentation.ubuntu.com/multipass/en/latest/explanation/driver/)。 如果你在这些文件中发现了过时的信息或不一致之处,请[提交 issue](https://github.com/canonical/multipass/issues),或者更好的是,提交一个 pull request! 你还可以参考我们的 [GitHub Actions CI](https://github.com/canonical/multipass/actions) 以了解 Multipass 是如何跨平台构建和测试的。 ### 自动链接器选择 ***需要 (>= CMake 3.29)*** 为了加速构建,构建系统将尝试定位并使用 `mold` 或 `lld`(依次查找)来替代工具链的默认链接器。若要覆盖此设置,请在 CMake 配置步骤中设置 [CMAKE_LINKER_TYPE](https://cmake.org/cmake/help/latest/variable/CMAKE_LINKER_TYPE.html#cmake-linker-type)。 ## 版权 本仓库中的代码采用 GNU General Public License v3.0 授权。 有关更多信息,请参阅 [LICENSE](https://github.com/canonical/multipass/blob/main/LICENSE)。 # 社区主导的集成 ## Multipass MCP Server - [WangYihang/multipass-mcp](https://github.com/WangYihang/multipass-mcp) ## Terraform providers - [todoroff/terraform-provider-multipass](https://github.com/todoroff/terraform-provider-multipass) - [larstobi/terraform-provider-multipass](https://github.com/larstobi/terraform-provider-multipass) ## Visual Studio Code 扩展 - [geoffreynyaga/multipass-run](https://github.com/geoffreynyaga/multipass-run) - [levalleyjack/multipass-manager-vscode](https://github.com/levalleyjack/multipass-manager-vscode) # 附加信息 [Multipass 文档](https://canonical.com/multipass/docs)
标签:Bash脚本, NIDS, SOC Prime, 云计算, 容器化, 开发工具, 本地开发环境, 虚拟机管理, 规则引擎, 身份验证强制