Lima快速起步

安装

Lima依赖 QEMU 7.0或更高版本,不过只在使用QEMU驱动时需要

Homebrew 安装 lima
brew install lima

不过,对于我使用的古老的 MacBook Pro 15" Late 2013 操作系统 Big Sur 11.7.10 , Homebrew 已经不再支持,所以我现在采用官方提供的二进制发行版解压缩到 /usr/local 目录使用:

二进制发行版安装 lima
VERSION=$(curl -fsSL https://api.github.com/repos/lima-vm/lima/releases/latest | jq -r .tag_name)
curl -fsSL "https://github.com/lima-vm/lima/releases/download/${VERSION}/lima-${VERSION:1}-$(uname -s)-$(uname -m).tar.gz" | tar Cxzvm /usr/local

# For Lima v1.1 onward
curl -fsSL "https://github.com/lima-vm/lima/releases/download/${VERSION}/lima-additional-guestagents-${VERSION:1}-$(uname -s)-$(uname -m).tar.gz" | tar Cxzvm /usr/local

使用

  • 快速启动:

执行 limactl 启动
limactl start

此时会进入一个交互菜单页面,使用上下键来选择菜单:

执行 limactl 启动进入交互菜单
> Proceed with the current configuration
  Open an editor to review or modify the current configuration
  Choose another template (docker, podman, archlinux, fedora, ...)
  Exit
  • 选则默认的 Proceed with the current configuration 就会下载 ubuntu-24.10 服务器镜像进行运行

  • 选择 Choose another template (docker, podman, archlinux, fedora, ...) 就可以选择不同的 Lima操作系统模版

备注

为了方便起停虚拟机,可以安装 xbar 来方便交互

定制

从模版选择定制启动
limactl create --name=default template://docker
limactl start default

模版

lima 通过模版来指导启动的虚拟机镜像获得、文件系统挂载等。 Lima操作系统模版 提供了官方支持的发行版莫辨,以及容器、 Kubernetes 模版

参考