Skip to content

Instantly share code, notes, and snippets.

@sergeycherepanov
Last active May 25, 2025 22:33
Show Gist options
  • Save sergeycherepanov/e80f3947f46a38767a2e2818ad63141d to your computer and use it in GitHub Desktop.
Save sergeycherepanov/e80f3947f46a38767a2e2818ad63141d to your computer and use it in GitHub Desktop.
# limactl start --name default --disk 128 --cpus 4 --memory 6 --vm-type=vz https://gist.githubusercontent.com/sergeycherepanov/e80f3947f46a38767a2e2818ad63141d/raw/lima-ubuntu-22-04-app.yml
images:
- location: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
arch: x86_64
- location: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-arm64.img
arch: aarch64
mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
networks:
- vzNAT: true
provision:
# Disable ssh key delition
- mode: system
script: |
#!/bin/sh
mkdir -p /etc/cloud/cloud.cfg.d
echo "ssh_deletekeys: false" > /etc/cloud/cloud.cfg.d/lima-local.cfg
# Update APT cache
- mode: system
script: |
apt -qqy update
# Install kernel modules
- mode: system
script: |
apt -qqy install linux-modules-extra-$(uname -r);
# Install ZRAM
- mode: system
script: |
apt -qqy install zram-tools
cd /etc/default
sed -i ~s~#PERCENT=.*~PERCENT=50~ zramswap
sed -i ~s~#ALGO=.*~ALGO=lz4~ zramswap; systemctl restart zramswap;
# Configure sshd
- mode: system
script: |
echo 'PasswordAuthentication yes' > /etc/ssh/sshd_config.d/45-lima-settings.conf
service ssh restart;
# Add app user
- mode: system
script: |
useradd -m -s /bin/bash -G sudo app
echo "app ALL=(ALL) ALL" > /etc/sudoers.d/50-app-user
echo app:pass | chpasswd --crypt-method=SHA512;
# Install Docker
- mode: system
script: "curl https://get.docker.com | bash; cat /etc/passwd | grep -v 'nologin\\|false' | awk -F: '$3>=500{print $1}' | xargs -I{} usermod -aG docker {}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment