118 lines
2.3 KiB
Markdown
118 lines
2.3 KiB
Markdown
# Lima
|
|
|
|
## Arbeitspfad
|
|
|
|
`export LIMA_HOME=/Volumes/untitled/lima`
|
|
|
|
## Konfig-File
|
|
```yaml
|
|
images:
|
|
- location: "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-arm64.qcow2"
|
|
arch: aarch64
|
|
|
|
cpus: 4
|
|
memory: "8GiB"
|
|
disk: "50GiB"
|
|
|
|
mounts:
|
|
- location: "~/projects"
|
|
writable: true
|
|
|
|
ssh:
|
|
loadDotSSHPubKeys: true
|
|
|
|
provision:
|
|
- mode: system
|
|
script: |
|
|
#!/bin/bash
|
|
apt-get update
|
|
apt-get install -y \
|
|
curl \
|
|
git \
|
|
vim \
|
|
build-essential
|
|
|
|
containerd:
|
|
system: false
|
|
user: false
|
|
```
|
|
|
|
## Start
|
|
|
|
`limactl start debian12.yaml`
|
|
|
|
später nur
|
|
|
|
`limactl start debian12`
|
|
|
|
## Stop
|
|
|
|
```
|
|
limactl stop debian12
|
|
```
|
|
|
|
## Löschen
|
|
|
|
```
|
|
limactl delete debian12
|
|
```
|
|
|
|
## Liste
|
|
|
|
```
|
|
limactl list
|
|
```
|
|
|
|
## Einloggen
|
|
|
|
```
|
|
limactl shell debian12
|
|
```
|
|
|
|
(Instanzname standardmäßig aus Dateiname)
|
|
|
|
## SSH kontrollieren
|
|
|
|
`limactl show-ssh debian12`
|
|
|
|
```
|
|
`WARN[0000] `limactl show-ssh` is deprecated. Instead, use `ssh -F /Volumes/untitled/lima/debian12/ssh.config lima-debian12`.
|
|
ssh -o 'IdentityFile="/Volumes/untitled/lima/_config/user"' -o 'IdentityFile="/Users/svenriwoldt/.ssh/id_rsa"' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes -o GSSAPIAuthentication=no -o 'Ciphers="^aes128-gcm@openssh.com,aes256-gcm@openssh.com"' -o User=svenriwoldt -o ControlMaster=auto -o 'ControlPath="/Volumes/untitled/lima/debian12/ssh.sock"' -o ControlPersist=yes -o Hostname=127.0.0.1 -o Port=61315 lima-debian12
|
|
```
|
|
|
|
|
|
|
|
## SCP
|
|
|
|
scp -P 61315 -i /Users/svenriwoldt/.ssh/id_rsa PF_neu.tgz 127.0.0.1:
|
|
|
|
## Editieren der Instanz
|
|
|
|
limactl edit debian12
|
|
|
|
## VSCode mit Lima
|
|
|
|
hier geht es darum per ssh auf mit VSCode auf den Container zu zugreifen:
|
|
|
|
Dafür existiert eine Skript welches den sich wechselnden Port vor Start des VSCode in die ssh-config einträgt.
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
VM=${1:-debian12}
|
|
|
|
# Alten Lima-Eintrag entfernen
|
|
sed -i '' '/^# lima-'$VM'/,/^$/d' ~/.ssh/config
|
|
|
|
# Aktuellen Eintrag neu schreiben
|
|
echo "# lima-$VM" >> ~/.ssh/config
|
|
limactl show-ssh --format config $VM >> ~/.ssh/config
|
|
|
|
echo "SSH-Config für '$VM' aktualisiert!"
|
|
```
|
|
|
|
Danach der Shift-cmd-P die ssh-Session aufrufen
|
|
|
|
## nvim mit Lima
|
|
|
|
Hier muss vorher das Paket .....
|