更多互联网新鲜资讯、工作奇淫技巧关注【飞鱼在浪屿】(日更新)
Lima:Mac上的Linux
Lima是在macOS安装,具有文件共享,端口转发和容器化功能的Linux虚拟机。
可以将Lima视为某种非官方的“ Linux的macOS子系统”,或“ Mac的容器”。
? 自动文件共享
? 自动端口转发
?内置对容器的支持
? Intel ARM
? Ubuntu
? Fedora
例子
- uanme
$ uname -a
Darwin macbook.local 20.4.0 Darwin Kernel Version 20.4.0:Thu Apr 22 21:46:47 PDT 2021; 根目录:xnu-7195.101.2?1 / RELEASE_X86_64 x86_64
$ lima uname -a
Linux lima-default 5.11.0-16-generic#17-Ubuntu SMP Wed Apr 14 20:12:43 UTC 2021 x86_64 x86_64 x86_64 GNU / Linux
$ LIMA_INSTANCE = arm lima uname -a
Linux lima-arm 5.11.0-16-generic#17-Ubuntu SMP Wed Apr 14 20:10:16 UTC 2021 aarch64 aarch64 aarch64 GNU / Linux
- 跨macOS和Linux共享文件
$ echo "files under /Users on macOS filesystem are readable from Linux" > some-file
$ lima cat some-file
files under /Users on macOS filesystem are readable from Linux
$ lima sh -c 'echo "/tmp/lima is writable from both macOS and Linux" > /tmp/lima/another-file'
$ cat /tmp/lima/another-file
/tmp/lima is writable from both macOS and Linux"
运行容器化容器(与Docker容器兼容)
$ lima nerdctl run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine
可从macOS和Linux访问http://127.0.0.1:8080。
注意 特权端口(1-1023)无法转发
入门要求(Intel Mac)
- coreutils(用于realpath命令)(brew install coreutils)
- qume(brew install qemu)
- 运行以下命令以启用--accel=hvf:
cat > entitlements.xml << EOF
<?xml version =“ 1.0” encoding =“ UTF-8”?>
<!DOCTYPE plist PUBLIC“-// Apple // DTD PLIST 1.0 // EN”“ http:// www .apple.com / DTDs / PropertyList-1.0.dtd“>
<plist version =” 1.0“>
<dict>
<key> com.apple.security.hypervisor </ key>
<true />
</ dict>
</ plist >
EOF
codesign -s---entitlements entitlements.xml --force / usr / local / bin / qemu-system-x86_64
注意:在10.15.7之前的macOS版本上,您可能需要另外添加:
<key>com.apple.vm.hypervisor</key>
<true/>
要求(ARM Mac)
- coreutils(用于realpath命令)(brew install coreutils)
- 具有--accel=hvf支持的QEMU ,请参阅https://gist.github.com/citruz/9896cd6fb63288ac95f81716756cb9aa
注意 Lima未在ARM Mac上进行测试。
安装
从https://github.com/AkihiroSuda/lima/releases下载二进制存档,然后将其解压缩到/usr/local(或其他位置)。
要从源代码安装,请运行make && make install。
本文暂时没有评论,来添加一个吧(●'◡'●)