Isolated, disposable development VMs โ one per client โ on libvirt/KVM.
kvm-devbox.sh is a single interactive Bash script that creates a VM with its own disk, private network, SSH key and identity, installs the development tools you pick, and wires up ~/.ssh/config so you can run ssh dev-<name> or open the VM straight from a JetBrains IDE over SSH.
Tip
Three commands to a ready VM: ./kvm-devbox.sh โ pick 1 โ ssh dev-<name>.
- Client isolation. Code, credentials, caches and toolchains of one client never touch another's. Each VM sits on its own NAT network (
10.10.N.0/24) with its own SSH key. - Reproducible. VMs are thin qcow2 overlays on a cached, checksum-verified base image. The base image is never modified.
- Disposable. Delete a VM and its disk, network, SSH config entry and (optionally) key are removed in one step.
- Fast to set up. No cloud-init: the disk is prepared offline with
virt-customize, so the VM is reachable over SSH on first boot.
- Features
- Host requirements
- Install the host tools
- Run the script
- Create a VM (walkthrough)
- Development tools catalog
- Connect over SSH
- Develop with JetBrains over SSH
- Managing VMs
- Configuration
- How it works
- Troubleshooting
- Ubuntu Server 26.04 LTS or Rocky Linux 10 cloud images, or your own local qcow2 file.
- Image download with SHA-256 verification and a local cache (
/var/lib/libvirt/images/base). - Per-VM isolated libvirt NAT network with a fixed IP (
10.10.N.10). - Per-VM ed25519 SSH key and an auto-generated
~/.ssh/configentry. - Optional console password (empty means SSH key only).
- Interactive tool installer (re-runnable on existing VMs) with per-language version selection.
- Local state in
~/.config/kvm-devbox/config.json, kept in sync with libvirt on every start. - UEFI guest support, automatic root-disk growth, passwordless
sudofor the dev user.
| Requirement | Notes |
|---|---|
| Linux with KVM | /dev/kvm must exist (enable VT-x/AMD-V in BIOS). Without it VMs are very slow. |
| Debian/Ubuntu-style host | The install hints use apt. Other distros work if you install the equivalent packages. |
sudo rights |
The script calls virsh, virt-install, qemu-img and libguestfs through sudo. |
| Resources per VM (default) | 4 vCPU, 12 GB RAM, 60 GB disk (thin-provisioned). Adjust in the script's settings block. |
| IDE (optional) | A JetBrains IDE (PyCharm, IntelliJ IDEA, WebStorm, ...) with Remote Development over SSH. |
On Ubuntu/Debian:
sudo apt update
sudo apt install -y \
qemu-system-x86 qemu-utils \
libvirt-daemon-system libvirt-clients \
virtinst \
libguestfs-tools guestfs-tools \
ovmf \
jq curl openssh-clientEnable and start libvirt, and make sure the default libvirt URI works:
sudo systemctl enable --now libvirtd
sudo virsh list --all # should print an (empty) table, no errorsVerify KVM acceleration is available:
ls -l /dev/kvm # must exist
sudo apt install -y cpu-checker && sudo kvm-okWhat each package is for:
| Package | Provides | Used for |
|---|---|---|
qemu-system-x86, qemu-utils |
QEMU, qemu-img |
Running VMs, creating overlay disks |
libvirt-daemon-system, libvirt-clients |
libvirtd, virsh |
VM and network management |
virtinst |
virt-install |
Defining and booting the VM |
libguestfs-tools, guestfs-tools |
virt-customize, virt-cat, guestfish |
Preparing the guest disk offline (user, SSH, network, hostname) |
ovmf |
UEFI firmware | Only needed for UEFI images |
jq |
JSON processor | Local config file |
curl, openssh-client |
curl, ssh, scp, ssh-keygen |
Image download, provisioning, connections |
The script checks for all required commands at startup and prints the exact apt install line if something is missing.
git clone <this-repository> kvm-devbox # or just copy the folder
cd kvm-devbox
chmod +x kvm-devbox.sh
./kvm-devbox.shYou will be asked for your sudo password once. The main screen lists the VMs managed by the script (dev-*), read-only entries for any other VMs on the host, and the menu:
| Option | Action |
|---|---|
| 1 | Create a new VM |
| 2 | Install development tools on an existing VM |
| 3 | Start / stop VMs (checklist) |
| 4 | Delete a VM |
| 5 | Quit |
Note
Set NO_COLOR=1 to disable colours. The UI falls back to plain ASCII when the locale is not UTF-8.
./kvm-devbox.sh # coloured UI
NO_COLOR=1 ./kvm-devbox.sh # plain output (logs, CI, screen readers)
LC_ALL=C ./kvm-devbox.sh # ASCII box drawingChoose 1, then answer the prompts.
- VM name.
personalbecomesdev-personal. Allowed:a-z,0-9,-(max 31 chars). - Operating system.
1Ubuntu Server 26.04 LTS (cloud image, no desktop)2Rocky Linux 10 (GenericCloud, no desktop)3Local qcow2 file (your own base image; it must never be booted or modified afterwards)
- Base image. If one is cached you are asked whether to download a newer one. New downloads are checksum-verified.
- Console password for the
devuser. Leave empty for SSH key only. - Development tools. Pick by number, space separated (
a= all, Enter = none), then choose versions.
In the example above, tools 1,2,6,9,10 were chosen: Node.js 24, Python 3.14, Docker, Claude Code and Kimi Code. The script then:
- generates a dedicated SSH key
~/.ssh/client-<name>(you can set a passphrase), - creates the isolated network
net-<name>(10.10.N.0/24), - creates a qcow2 overlay on the base image and prepares it offline,
- defines and starts the VM,
- appends a
Host dev-<name>block to~/.ssh/config, - waits for SSH and runs the tool installer inside the VM.
When finished a summary shows the SSH command, IP, user and key path:
+ โ Network net-personal created (10.10.5.0/24)
+ โ Disk ready: /var/lib/libvirt/images/client-personal.qcow2
+ โ VM dev-personal started
+ โ SSH is up
+ โ Development tools installed on dev-personalโญโ Ready โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ dev-personal is up and running โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ SSH ssh dev-personal โ
โ Address 10.10.5.10 โ
โ User dev โ
โ Key /home/<you>/.ssh/client-personal โ
โ OS ubuntu-26.04 โ
โ Tools claude, docker, kimi, node, python โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ JetBrains Gateway: host dev-personal with 'Parse config ...' โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
If a tool fails, the provisioning summary shows it in red and the other tools are still installed:
+ [ok] Node.js 24 (nvm)
+ [ok] Python 3.14 (uv + Poetry)
+ [ok] Docker + Docker Compose
- [failed] Kimi Code
! Re-run option 2 to retry only what is missing.Important
Option 3 (local qcow2) uses your file as a backing image. Never boot or modify it afterwards, or every VM disk based on it will be corrupted.
Selected tools are installed inside the VM for the dev user. Each step is independent: a failure in one does not stop the others, and you can re-run option 2 to retry.
| # | Tool | Installed via | Default versions |
|---|---|---|---|
| 1 | Node.js | nvm | 24 22 |
| 2 | Python | uv + Poetry | 3.14 3.13 |
| 3 | Java JDK | SDKMAN (Temurin) | 25 21 |
| 4 | PHP + Composer | ondrej PPA (Ubuntu) / Remi (Rocky) | 8.4 8.3 |
| 5 | .NET SDK / C# | dotnet-install.sh |
10.0 8.0 |
| 6 | Docker + Compose | Docker apt/dnf repo | latest |
| 7 | Ollama | official installer | latest |
| 8 | LM Studio (headless llmster) |
official installer | latest |
| 9 | Claude Code | npm i -g @anthropic-ai/claude-code |
latest |
| 10 | Kimi Code | official installer | latest |
Notes:
- The first version in a list is the default (
nvm alias default,sdk default java, ...). - Claude Code needs Node.js; if you pick it without Node.js, the Node LTS is added automatically.
- Ollama and LM Studio run on CPU inside the VM. Raise
MEMORYin the script (16 GB or more recommended). - Docker: log out and back in to use
dockerwithoutsudo. LM Studio: start the daemon withlms daemon up. - Environment setup lives in
~/.devbox_env, loaded from~/.bashrcand~/.profile. Open a new SSH session after installing soPATHis refreshed. - Installed tools are recorded in
~/.devbox_installedin the VM and in the local config.
The script creates this entry in ~/.ssh/config:
Host dev-personal
HostName 10.10.5.10
User dev
IdentityFile /home/<you>/.ssh/client-personal
IdentitiesOnly yes
StrictHostKeyChecking accept-newSo connecting is simply:
ssh dev-personalUseful one-liners:
ssh dev-personal 'node --version && python --version' # run a command
scp ./notes.txt dev-personal:~/ # copy a file in
ssh -L 3000:localhost:3000 dev-personal # forward a dev server port
ssh -t dev-personal docker ps # needs a TTYWith one VM per client, the config file simply grows one block per client:
Host dev-acme
HostName 10.10.1.10
User dev
IdentityFile ~/.ssh/client-acme
IdentitiesOnly yes
Host dev-globex
HostName 10.10.2.10
User dev
IdentityFile ~/.ssh/client-globex
IdentitiesOnly yesInside the VM everything installed is ready to use, for example Node.js and Claude Code:
JetBrains IDEs run the IDE backend inside the VM and show a thin client on your desktop, so indexing, builds and tooling all happen in the isolated environment. This works with PyCharm, IntelliJ IDEA, WebStorm, PhpStorm, Rider and the others, either from the IDE's welcome screen or from JetBrains Gateway.
- The VM is running and
ssh dev-<name>works from a terminal. - At least 4 GB of free RAM inside the VM for the IDE backend (the default 12 GB is plenty).
a) Open Remote Development โ SSH. On the welcome screen choose Remote Development โ SSH and click New Project.
b) Create the SSH connection. Click the gear / New Connection and fill in the VM details. The values come from the "Ready" summary shown by the script (or from ~/.ssh/config):
| Field | Value |
|---|---|
| Host | 10.10.5.10 (the VM IP, 10.10.N.10) |
| Port | 22 |
| Username | dev |
| Authentication type | Key pair (OpenSSH or PuTTY) |
| Private key file | ~/.ssh/client-<name> |
Parse config file ~/.ssh/config |
enabled |
Click Test Connection to verify.
Tip
With Parse config file ~/.ssh/config enabled you can instead enter the host alias dev-<name> and the IDE picks up the user, address and key automatically.
c) Check the connection. Select the connection (dev@10.10.5.10:22 key) and click Check Connection and Continue.
d) Pick the IDE and project folder. Choose the IDE version to download into the VM and the project directory (for example /home/dev/project), then click Download IDE and Connect. The IDE opens as a thin client connected to the VM.
Note
The IDE backend is downloaded inside the VM on first use, so the VM needs internet access. This works out of the box, since the VM network is NAT.
Everything is installed under the dev user's home, so point the IDE at it:
| Tool | Path inside the VM |
|---|---|
| Python (uv) | ~/.local/bin/python, uv-managed versions under ~/.local/share/uv/python |
| Node.js (nvm) | ~/.nvm/versions/node/<version>/bin/node |
| Java (SDKMAN) | ~/.sdkman/candidates/java/<version> |
| .NET | ~/.dotnet |
| PHP | /usr/bin/php<version> or /usr/local/bin/php |
| Docker | /var/run/docker.sock (log out/in after install) |
| Task | How |
|---|---|
| List VMs | Run the script; the table shows name, subnet N, IP, OS and state |
| Add or update tools | Option 2, pick the VM, pick tools (already installed tools are shown) |
| Start / stop VMs | Option 3, tick the VMs you want running (see below) |
| Delete a VM | Option 4, type the VM name to confirm. Removes the VM (and NVRAM), its client-<name>.qcow2 disk, the network, the SSH config entry and known_hosts entry; asks before deleting the SSH key. Base images are never deleted |
| Console | sudo virsh console dev-<name> (needs a console password) |
Option 3 shows every managed VM as a checklist. A ticked VM should be running, an unticked one should be off. Toggle what you want, press Enter, and only the differences are applied.
โญโ Start / stop VMs โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ [x] dev-acme โ running โ
โ โฏ [x] dev-globex โ shut off โฏ start โ
โ [ ] dev-personal โ running โฏ stop โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ space = select โข a = all โข Enter = apply โข q = cancel โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
| Key | Action |
|---|---|
โ / โ (or k / j) |
Move |
Space |
Tick / untick the VM |
a |
Tick all (or untick all if all are ticked) |
Enter |
Apply: start ticked VMs that are off, shut down unticked VMs that are running |
q / Esc |
Cancel without changes |
+ โ dev-globex is running (ssh dev-globex)
- โ dev-personal is offShutdown is a clean ACPI request and the script waits up to 60 s. If a guest ignores it you are told how to force it with sudo virsh destroy. Paused VMs are resumed when ticked.
The same actions from the command line:
sudo virsh start dev-personal # power on
sudo virsh shutdown dev-personal # clean shutdown
sudo virsh console dev-personal # serial console (exit with Ctrl+])
sudo virsh net-list --all # one net-<name> per VMVMs created or removed outside the script are detected on the next run and the local config is updated. VMs without the dev- prefix are shown read-only and are never touched.
Deleting asks you to type the VM name, then removes everything it created:
- VM dev-personal
- Disk /var/lib/libvirt/images/client-personal.qcow2
- Network net-personal
- SSH 'dev-personal' entry in ~/.ssh/configEdit the settings block at the top of kvm-devbox.sh:
| Variable | Default | Meaning |
|---|---|---|
PREFIX |
dev- |
Only VMs with this prefix are managed |
IMG_DIR |
/var/lib/libvirt/images |
Where VM disks live |
BASE_DIR |
$IMG_DIR/base |
Cached base images |
SUBNET_PREFIX |
10.10 |
Networks are 10.10.N.0/24, VM at .10 |
MEMORY |
12288 |
RAM per VM in MB |
VCPUS |
4 |
vCPUs per VM |
DISK_SIZE |
60G |
Virtual disk size for cloud images |
CLOUD_USER |
dev |
User created in cloud images |
Example override (for heavier workloads such as local LLMs):
PREFIX="dev-"
-MEMORY=12288
+MEMORY=24576
-VCPUS=4
+VCPUS=8
-DISK_SIZE=60G
+DISK_SIZE=120GState files:
~/.config/kvm-devbox/config.json: VM inventory (if corrupted, delete it; it is rebuilt from KVM).~/.ssh/client-<name>[.pub]: per-VM SSH key./var/lib/libvirt/images/client-<name>.qcow2: per-VM disk.
Example ~/.config/kvm-devbox/config.json:
{
"last_n": 5,
"vms": {
"dev-personal": {
"network": "net-personal",
"n": 5,
"ip": "10.10.5.10",
"os": "ubuntu-26.04",
"user": "dev",
"tools": { "node": "24", "python": "3.14", "docker": "yes", "claude": "yes" }
}
},
"unmanaged": ["neon"]
} base image (read-only, cached) /var/lib/libvirt/images/base/ubuntu-YYYYMMDD-HHMM.qcow2
โฒ backing file
client overlay (thin qcow2) /var/lib/libvirt/images/client-<name>.qcow2
โฒ
libvirt VM dev-<name> โโ virtio NIC โโโบ net-<name> 10.10.N.0/24 (NAT) โโโบ internet
โโโ VM: 10.10.N.10 (static DHCP lease by MAC)
virt-customizeedits the overlay offline: hostname, new SSH host keys,devuser with passwordless sudo, injected public key, DHCP network config,sshd, disk growth, SELinux relabel.virt-install --importboots it. There is no cloud-init, so first boot is fast.- A provisioning script is copied over SSH and run in the VM to install the chosen tools.
| Problem | Fix |
|---|---|
missing commands: ... |
Install the packages from step 1. |
/dev/kvm not found |
Enable virtualization in BIOS/UEFI; check lsmod | grep kvm. |
UEFI image: install the firmware |
sudo apt install ovmf |
SSH on dev-... did not come up within 3 minutes |
Check sudo virsh list --all and sudo virsh console dev-<name>; make sure libvirtd and the network (sudo virsh net-list --all) are active. |
Host key verification failed after recreating a VM |
ssh-keygen -R 10.10.N.10 (the script does this on create/delete). |
| libguestfs errors about the kernel | Run the script as intended (libguestfs runs under sudo); on Ubuntu hosts /boot/vmlinuz-* must be readable by root, which it is by default. |
| Some tools fail to install | Read the summary at the end of provisioning, then run option 2 again to retry. |
docker: permission denied |
Log out and back in so the docker group applies. |
| JetBrains cannot connect | Confirm ssh dev-<name> works in a terminal, the key path is correct, and the VM has internet access for the IDE backend download. |





