在MacOS安装Linux子系统 – Lima

在MacOS安装Linux子系统 – LimaLima 是在 macOS 安装 具有文件共享 端口转发和容器化功能的 Linux 虚拟机 要从源代码安装 请运行 make amp amp make install

大家好,欢迎来到IT知识分享网。

更多互联网新鲜资讯、工作奇淫技巧关注【飞鱼在浪屿】(日更新)

在MacOS安装Linux子系统 - Lima

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“> 
     
      
      
        com.apple.security.hypervisor 
        
        
        
        EOF codesign -s---entitlements entitlements.xml --force / usr / local / bin / qemu-system-x86_64 
       
      
    

注意:在10.15.7之前的macOS版本上,您可能需要另外添加:

 
    
      com.apple.vm.hypervisor 
     
    

要求(ARM Mac)

  • coreutils(用于realpath命令)(brew install coreutils)
  • 具有–accel=hvf支持的QEMU ,请参阅https://gist.github.com/citruz/9896cd6fb63288ac95fcb9aa

注意 Lima未在ARM Mac上进行测试。


安装

从https://github.com/AkihiroSuda/lima/releases下载二进制存档,然后将其解压缩到/usr/local(或其他位置)。

要从源代码安装,请运行make && make install。

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/90223.html

(0)
上一篇 2026-03-31 15:20
下一篇 2022-12-18 15:50

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信