notes/cmd/lima.md
2024-06-26 11:28:41 +02:00

2 KiB
Raw Blame History

https://medium.com/@harry-touloupas/when-mac-m1-m2-met-ebpf-a-tale-of-compatibility-6b9a6bc53f3e

  • brew install lima
  • create file ubuntu-lts-ebpf.yaml:
  images:
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20230518/ubuntu-22.04-server-cloudimg-amd64.img"
  arch: "x86_64"
  digest: "sha256:afb820a9260217fd4c5c5aacfbca74aa7cd2418e830dc64ca2e0642b94aab161"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20230518/ubuntu-22.04-server-cloudimg-arm64.img"
  arch: "aarch64"
  digest: "sha256:b47f8be40b5f91c37874817c3324a72cea1982a5fdad031d9b648c9623c3b4e2"
# Fallback to the latest release image.
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img"
  arch: "x86_64"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-arm64.img"
  arch: "aarch64"

memory: "2GiB"
cpus: 2
disk: "30GiB"
ssh:
  # You can choose any port or omit this. Specifying a value ensures same port bindings after restarts
  # Forwarded to port 22 of the guest.
  localPort: 2222
# We are going to install all the necessary packages for our development environment.
# These include Python 3 and the bpfcc tools package.
provision:
  - mode: system
    script: |
      #!/bin/bash
      set -eux -o pipefail
      export DEBIAN_FRONTEND=noninteractive
      apt update && apt-get install -y vim python3 bpfcc-tools linux-headers-$(uname -r)
  - mode: user
    script: |
      #!/bin/bash
      set -eux -o pipefail
      sudo cp /home/$(whoami).linux/.ssh/authorized_keys /root/.ssh/authorized_keys
  • limactl start --name=ebpf-lima-vm ./ubuntu-lts-ebpf.yaml
    
  • cat ~/.lima/ebpf-lima-vm/ssh.config >> ~/.ssh/config. #It appends Limas SSH configuration options to your default SSH options just to make it easier for PyCharm to connect to the VM.