# Lima - macOS 上的 Linux 虚拟机，像 WSL2 一样

**URL:** <https://meta.appinn.net/t/topic/57055>\
**Category:** 青蛙的应用\
**Created:** [2024 年5 月 29 日 12:18 UTC](https://meta.appinn.net/t/topic/57055 "2024-05-29T12:18:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

作者： ![Qingwa](https://meta-edge.appinn.com/user_avatar/meta.appinn.net/qingwa/32/58632_2.png) [@Qingwa](https://meta.appinn.net/u/Qingwa)\
发布日期： [2024 年5 月 29 日 12:18 UTC](https://meta.appinn.net/t/topic/57055/1 "2024-05-29T12:18:55Z")

</div>

原始链接在： [Lima - macOS 上的 Linux 虚拟机、Docker 容器，像 WSL2 一样 - 小众软件](https://www.appinn.com/lima-vm/)

**Lima** 是一款运行在 macOS 上的 Linux 虚拟机，支持文件共享和端口转发，支持 Docker，就像 Windows 系统里自带的虚拟机 WSL2 一样。@[Appinn](https://www.appinn.com/lima-vm/)

  
 ![](https://www.appinn.com/wp-content/uploads/2024/05/Appinn-feature-images-2024-05-29T200128.051.jpg)

以前在 Mac 上想要安装 Linux 虚拟机，至少还要折腾一下是选 PD 还是选 VM，然后下载个 Linux 镜像文件，现在就…

## 第一步：安装 Lima

```
brew install lima
```

## 第二步：安装一个 Linux

```
limactl create appinn
```

选择模板（系统）后，几分钟就下载并安装好了。

## 第三步：打开 shell

```
lima
```

就…很方便。

支持通过模板启动机器，一台虚拟机大概也就几分钟完成。

## 一个例子：启动一个 Docker 容器

```
limactl start template://docker
export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')
docker run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine
```

以上命令将启动一个 nginx 容器，并打开本机的 8080 端口

### 支持的 Linux 发行版本

- [`almalinux-8`](https://github.com/lima-vm/lima/tree/master/examples/almalinux-8.yaml): AlmaLinux 8
- [`almalinux-9`](https://github.com/lima-vm/lima/tree/master/examples/almalinux-9.yaml), `almalinux.yaml`: AlmaLinux 9
- [`alpine`](https://github.com/lima-vm/lima/tree/master/examples/alpine.yaml): ☆Alpine Linux
- [`archlinux`](https://github.com/lima-vm/lima/tree/master/examples/archlinux.yaml): ⭐Arch Linux
- [`centos-stream-8`](https://github.com/lima-vm/lima/tree/master/examples/centos-stream-8.yaml): CentOS Stream 8
- [`centos-stream-9`](https://github.com/lima-vm/lima/tree/master/examples/centos-stream-9.yaml), `centos-stream.yaml`: CentOS Stream 9
- [`debian-11`](https://github.com/lima-vm/lima/tree/master/examples/debian-11.yaml): Debian GNU/Linux 11(bullseye)
- [`debian-12`](https://github.com/lima-vm/lima/tree/master/examples/debian-12.yaml), `debian.yaml`: ⭐Debian GNU/Linux 12(bookworm)
- [`fedora`](https://github.com/lima-vm/lima/tree/master/examples/fedora.yaml): ⭐Fedora
- [`opensuse`](https://github.com/lima-vm/lima/tree/master/examples/opensuse.yaml): ⭐openSUSE Leap
- [`oraclelinux-8`](https://github.com/lima-vm/lima/tree/master/examples/oraclelinux-8.yaml): Oracle Linux 8
- [`oraclelinux-9`](https://github.com/lima-vm/lima/tree/master/examples/oraclelinux-9.yaml), `oraclelinux.yaml`: Oracle Linux 9
- [`rocky-8`](https://github.com/lima-vm/lima/tree/master/examples/rocky-8.yaml): Rocky Linux 8
- [`rocky-9`](https://github.com/lima-vm/lima/tree/master/examples/rocky-9.yaml), `rocky.yaml`: Rocky Linux 9
- [`ubuntu`](https://github.com/lima-vm/lima/tree/master/examples/ubuntu.yaml): Ubuntu (same as `default.yaml` but without extra YAML lines)
- [`ubuntu-lts`](https://github.com/lima-vm/lima/tree/master/examples/ubuntu-lts.yaml): Ubuntu LTS (same as `ubuntu.yaml` but pinned to an LTS version)
- [`deprecated/centos-7`](https://github.com/lima-vm/lima/tree/master/examples/deprecated/centos-7.yaml): [deprecated] CentOS Linux 7
- [`experimental/gentoo`](https://github.com/lima-vm/lima/tree/master/examples/experimental/gentoo.yaml): [experimental] Gentoo
- [`experimental/opensuse-tumbleweed`](https://github.com/lima-vm/lima/tree/master/examples/experimental/opensuse-tumbleweed.yaml): [experimental] openSUSE Tumbleweed

### 容器：

- [`apptainer`](https://github.com/lima-vm/lima/tree/master/examples/apptainer.yaml): Apptainer
- [`apptainer-rootful`](https://github.com/lima-vm/lima/tree/master/examples/apptainer-rootful.yaml): Apptainer (rootful)
- [`docker`](https://github.com/lima-vm/lima/tree/master/examples/docker.yaml): ⭐Docker
- [`docker-rootful`](https://github.com/lima-vm/lima/tree/master/examples/docker-rootful.yaml): Docker (rootful)
- [`podman`](https://github.com/lima-vm/lima/tree/master/examples/podman.yaml): Podman
- [`podman-rootful`](https://github.com/lima-vm/lima/tree/master/examples/podman-rootful.yaml): Podman (rootful)
- LXD is installed in the default Ubuntu template, so there is no `lxd.yaml`

### 容器镜像构建器：

- [`buildkit`](https://github.com/lima-vm/lima/tree/master/examples/buildkit.yaml): BuildKit

### 容器编排：

- [`faasd`](https://github.com/lima-vm/lima/tree/master/examples/faasd.yaml): [Faasd](https://docs.openfaas.com/deployment/faasd/)
- [`k3s`](https://github.com/lima-vm/lima/tree/master/examples/k3s.yaml): Kubernetes via k3s
- [`k8s`](https://github.com/lima-vm/lima/tree/master/examples/k8s.yaml): Kubernetes via kubeadm
- [`experimental/u7s`](https://github.com/lima-vm/lima/tree/master/examples/experimental/u7s.yaml): [Usernetes](https://github.com/rootless-containers/usernetes): Rootless Kubernetes

Optional feature enablers:

- [`vmnet`](https://github.com/lima-vm/lima/tree/master/examples/vmnet.yaml): ⭐enable [`vmnet.framework`](https://github.com/lima-vm/lima/tree/master/docs/network.md)
- [`experimental/9p`](https://github.com/lima-vm/lima/tree/master/examples/experimental/9p.yaml): [experimental] use 9p mount type
- [`experimental/virtiofs-linux`](https://github.com/lima-vm/lima/tree/master/examples/experimental/9p.yaml): [experimental] use virtiofs mount type for Linux
- [`experimental/armv7l`](https://github.com/lima-vm/lima/tree/master/examples/experimental/armv7l.yaml): [experimental] ARMv7
- [`experimental/riscv64`](https://github.com/lima-vm/lima/tree/master/examples/experimental/riscv64.yaml): [experimental] RISC-V
- [`experimental/net-user-v2`](https://github.com/lima-vm/lima/tree/master/examples/experimental/net-user-v2.yaml): [experimental] user-v2 network to enable VM-to-VM communication without root privilege
- [`experimental/vnc`](https://github.com/lima-vm/lima/tree/master/examples/experimental/vnc.yaml): [experimental] use vnc display and xorg server

带星星 ⭐ 的是稳定性比较好的系统。

## 获取

- [官网](https://lima-vm.io/)
- [文档](https://lima-vm.io/docs/)

* * *

原文：https://www.appinn.com/lima-vm/
